Hibernate Relational Associations Tutorial
Two important features of Hibernate are Inheritance (Hierarchical) Mapping (supported by table-per-subclass etc.) and Relational Associations (supported by one-to-many etc.) The first one is discussed earlier and now let us go for the second one.
In database terminology, an association denotes a relationship between two tables. This tutorial explains the way how Hibernate writes Java bean classes to implement this relation.
Some table associations require an extra join table with primary and foreign keys which Hibernate also supports. As in SQL, it is not a good idea to have nullable foreign keys and this is not a requirement for Hibernate.
The associations may be unidirectional or bidirectional.
The 4 associations Hibernate supports are
More than writing association classes, it requires a good logic to choose which association suits to the application.