liveBook · Manning

JavaBeans

As explained in Java Persistence with Spring Data and Hibernate epub

The JavaBean specification defines conventions for Java component properties, including the naming of getter and setter methods.

JavaBeans defines naming conventions that let generic Java tools discover and manipulate object properties. A property typically uses a private or protected field with an accessor pair: getProperty() retrieves its value and setProperty(value) changes it. Boolean properties may use isProperty() instead of getProperty(). section 3.2.3

A conventional property

A User property named username follows the convention with getUsername() and setUsername(String username). The methods can preserve encapsulation while exposing the property to persistence and other generic tools. section 3.2.3

Hibernate does not require accessors for persistence. It can call accessor methods or access fields directly, allowing selected accessors to be non-public, omitted, or replaced by configured field access. section 3.2.3

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Defines getter and setter naming, then compares accessor-based persistence with direct field access without detailing framework configuration.
Examples
Uses a User username property, a computed name property, and a setter that splits one name into separate fields.
What it assumes
Assumes basic Java classes, fields, methods, and object properties while treating accessor conventions as the introduced mechanism.
What you can do after
Apply JavaBean naming conventions and choose between accessor and field access when designing persistent classes.
How it connects
Connects JavaBeans with POJOs, JPA entity programming, Hibernate, Java Reflection API, and persistent domain models.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Java Persistence with Spring Data and Hibernate epub. The section links point to the parts of the book it draws on.