Hibernate Relationship Mapping

Mapping relation between classes to relation between tables is a very important part of any ORM. The relationship between classes may have varied multiplicity at the relation ends. One multiplicity can be mapped with simple or as . The Many multiplicity requires collection with or mapping.
Associations can be unidirectional or bidirectional. In hibernate, associations are inherently unidirectional.
There are three types of associations present between two classes:

  • many-to-many association
  • one-to-many or many-to-one association
  • one-to-one association

Further the above associations are unidirectional as well as bidirectional. The examples for all combinations are explained below:

please click on the mapping name to start tutorial

Reader can also check more hibernate tutorials from here