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


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