Chapter 3. Domain models and metadata
Listing 3.1. POJO implementation of the User class
Listing 3.2. POJO implementation of the User class with logic in accessor methods
Listing 3.3. A convenience method simplifies relationship management
Listing 3.4. Enforcing integrity of relationships with a constructor
Listing 3.5. Global metadata in a package-info.java file
Listing 3.6. Applying validation constraints on Item entity fields
Listing 3.7. Testing an Item instance for constraint violations
Listing 3.8. JPA XML descriptor containing the mapping metadata of a persistence unit
Listing 3.9. Metadata document in Hibernate’s native XML syntax
Listing 3.10. Obtaining entity type information with the Metamodel API
Listing 3.11. Obtaining entity attribute information with the Metamodel API
Chapter 4. Mapping persistent classes
Listing 4.1. Mapped Item entity class with an identifier property
Listing 4.2. Hibernate identifier generator configured as package-level metadata
Listing 4.3. @Table annotation overrides the mapped table name
Listing 4.4. PhysicalNamingStrategy, overriding default naming conventions
Chapter 5. Mapping value types
Listing 5.1. Overriding access strategy for the name property
Listing 5.2. Two read-only derived properties
Listing 5.3. Transforming column values with SQL expressions
Listing 5.4. Database-generated property values
Listing 5.5. Property of a temporal type that must be annotated with @Temporal
Listing 5.6. Address class: an embeddable component