Hibernate

Has-A- Mapping
Previous Home Next

Has-A relation between object can be of following three types:-

  1. One-to-One (Unidirectional and bidirectional)
  2. One-to-Many (Unidirectional and bidirectional)
  3. Many-to-Many (Unidirectional and bidirectional)

One-to-One Mapping:-

One to one mapping between object can be implement with the three ways.In case of unidirectional:-

  • Using primary key-foreign key relation
  • Using same primary Key
  • Using relation table

Disadvantages:-

This approach can only be used if relation between objects which be one to one.If in future one to one is changed to one to many then this approach went to wrong.

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: