6.1. Persistent collections ........................................................................................................ 79
6.2. Collection mappings ......................................................................................................... 79
6.2.1. Collection foreign keys .......................................................................................... 81
6.2.2. Collection elements ............................................................................................... 81
6.2.3. Indexed collections ................................................................................................ 81
6.2.4. Collections of values and many-to-many associations .............................................. 82
6.2.5. One-to-many associations ...................................................................................... 84
6.3. Advanced collection mappings .......................................................................................... 84
6.3.1. Sorted collections .................................................................................................. 84
6.3.2. Bidirectional associations ....................................................................................... 85
6.3.3. Bidirectional associations with indexed collections .................................................. 86
6.3.4. Ternary associations .............................................................................................. 87
6.3.5. Using an <idbag> .................................................................................................. 88
6.4. Collection examples ......................................................................................................... 88
7. Association Mappings ............................................................................................................... 91
7.1. Introduction ..................................................................................................................... 91
7.2. Unidirectional associations ............................................................................................... 91
7.2.1. many to one .......................................................................................................... 91
7.2.2. one to one ............................................................................................................. 91
7.2.3. one to many .......................................................................................................... 92
7.3. Unidirectional associations with join tables ........................................................................ 93
7.3.1. one to many .......................................................................................................... 93
7.3.2. many to one .......................................................................................................... 93
7.3.3. one to one ............................................................................................................. 94
7.3.4. many to many ....................................................................................................... 94
7.4. Bidirectional associations ................................................................................................. 94
7.4.1. one to many / many to one ..................................................................................... 95
7.4.2. one to one ............................................................................................................. 95
7.5. Bidirectional associations with join tables .......................................................................... 96
7.5.1. one to many / many to one ..................................................................................... 96
7.5.2. one to one ............................................................................................................. 97
7.5.3. many to many ....................................................................................................... 98
7.6. More complex association mappings ................................................................................. 98
8. Component Mapping .............................................................................................................. 100
8.1. Dependent objects .......................................................................................................... 100
8.2. Collections of dependent objects ..................................................................................... 101
8.3. Components as Map indices ............................................................................................ 102
8.4. Components as composite identifiers ............................................................................... 102
8.5. Dynamic components ..................................................................................................... 104
9. Inheritance Mapping ............................................................................................................... 105
9.1. The Three Strategies ....................................................................................................... 105
9.1.1. Table per class hierarchy ...................................................................................... 105
9.1.2. Table per subclass ............................................................................................... 106
9.1.3. Table per subclass, using a discriminator ............................................................... 106
9.1.4. Mixing table per class hierarchy with table per subclass ......................................... 107
9.1.5. Table per concrete class ....................................................................................... 107
9.1.6. Table per concrete class, using implicit polymorphism ........................................... 108
9.1.7. Mixing implicit polymorphism with other inheritance mappings ............................. 109
9.2. Limitations .................................................................................................................... 109
10. Working with objects ............................................................................................................ 111
10.1. Hibernate object states .................................................................................................. 111
10.2. Making objects persistent .............................................................................................. 111
HIBERNATE - Relational Persistence for Idiomatic Java
Hibernate 3.2.1 iv