Hibernate.orgCommunity Documentation

Hibernate Domain Model Mapping Guide

Hibernate - Relational Persistence for Idiomatic Java

5.0.12.Final

2017-01-19


Table of Contents

Preface
1. Data categorizations
1.1. Value types
1.2. Entity Types
1.3. Significance of type categories
2. Entity
2.1. POJO Models
2.1.1. Prefer non-final classes
2.1.2. Implement a no-argument constructor
2.1.3. Declare getters and setters for persistent attributes
2.1.4. Provide identifier attribute(s)
2.1.5. Mapping the entity
2.1.6. Mapping optimistic locking
2.1.7. Inheritance
3. Basic Types
3.1. Hibernate-provided BasicTypes
3.2. The @Basic annotation
3.3. The @Column annotation
3.4. BasicTypeRegistry
3.5. Explicit BasicTypes
3.6. Custom BasicTypes
3.7. Mapping enums
3.7.1. @Enumerated
3.7.2. AttributeConverter
3.7.3. Custom type
3.8. Mapping LOBs
3.9. Mapping Nationalized Character Data
3.10. Mapping UUID Values
3.10.1. UUID as binary
3.10.2. UUID as (var)char
3.10.3. PostgeSQL-specific UUID
3.10.4. UUID as identifier
3.11. Mapping Date/Time Values
3.12. JPA 2.1 AttributeConverters
4. Compositions
4.1. Component / Embedded
4.2. Multiple compositions
4.2.1. JPA's AttributeOverride
4.2.2. ImplicitNamingStrategy
4.3. Collections of compositions
4.4. Compositions as Map key
4.5. Compositions as identifiers
5. Collections
5.1. Collections as a value type
5.2. Collections of value types
5.3. Collections of entities
5.4. List - index
5.5. Map - key
5.6. Bags
5.7. Arrays
5.8. Collections as basic value type
6. Identifiers
6.1. Simple identifiers
6.2. Composite identifiers
6.2.1. Composite identifiers - aggregated (EmbeddedId)
6.2.2. Composite identifiers - non-aggregated (IdClass)
6.3. Generated identifier values
6.3.1. Interpreting AUTO
6.3.2. Using sequences
6.3.3. Using IDENTITY columns
6.3.4. Using identifier table
6.3.5. Using UUID generation
6.3.6. Using @GenericGenerator
6.3.7. Optimizers
6.4. Derived Identifiers
7. Natural Ids
7.1. Natural Id Mapping
7.2. Natural Id API
7.3. Natural Id - Mutability and Caching

List of Tables

3.1. Standard BasicTypes
3.2. BasicTypes added by hibernate-java8

List of Examples

1.1. Simple table and domain model
2.1. Simple @Entity
2.2. Simple @Entity with @Table
2.3. Version
3.1. With @Basic
3.2. Without @Basic
3.3. Explicit column naming
3.4. Using @org.hibernate.annotations.Type
3.5. Custom BasicType implementation
3.6. Custom UserType implementation
3.7. @Enumerated(ORDINAL) example
3.8. @Enumerated(STRING) example
3.9. Enum mapping with AttributeConverter example
3.10. Enum mapping with custom Type example
3.11. CLOB - SQL
3.12. CLOB - locator mapping
3.13. CLOB - materialized mapping
3.14. CLOB - materialized char[] mapping
3.15. BLOB - SQL
3.16. BLOB - locator mapping
3.17. BLOB - materialized mapping
3.18. NVARCHAR mapping
3.19. NCLOB (locator) mapping
3.20. NCLOB (materialized) mapping
4.1. Simple composition example
4.2. Simple Embedded
4.3. Person table
4.4. Alternative to composition
4.5. Multiple compositions
4.6. JPA's AttributeOverride
4.7. Enabling composition-safe implicit naming
4.8. Enabling composition-safe implicit naming
5.1. Delimited set of tags
6.1. Simple assigned identifier
6.2. Simple generated identifier
6.3. Basic EmbeddedId
6.4. EmbeddedId with ManyToOne
6.5. Basic IdClass
6.6. IdClass with ManyToOne
6.7. IdClass with partial generation
6.8. Unnamed sequence
6.9. Named sequence
6.10. Configured sequence
6.11. Table generator table structure
6.12. Unnamed table generator
6.13. Implicitly using the random UUID strategy
6.14. Implicitly using the random UUID strategy
7.1. Natural id using single basic attribute
7.2. Natural id using single embedded attribute
7.3. Natural id using multiple persistent attributes
7.4. Using NaturalIdLoadAccess
7.5. Using SimpleNaturalIdLoadAccess
7.6. Mutable natural id
7.7. Mutable natural id synchronization use-case
7.8. Natural id caching