Thursday 24 May 2012

Association Mapping

When tables are there in association or relationship we can access one table data based on anther table data because records of one table represents the records of anther table.


DB team takes the support of primary key, foriegn key constraints to design the table having relationships

Def:When two database tables are in relationships their HB POJO classes must be designed and configured supporting that relationship. This work is called Association Mapping in Hibernate Mapping File


                                                      HB Object Level Relationships
                                                                           |
                                                                           |
                                                       __________|____________
                                                      |                                            |
                                          Uni-Directional                       Bi-Directional
                                           (One-One)                               (One-One)
                                            (One-Many)                           (One-Many)
                                            (Many-Many)                          (Many-Many)

What is Uni-Directional?
Ans: By Using Parent POJO class Object data if we are able to access the associated child POJO class Object/ Object data and reverse is not possible than it is called Uni-Directional Association.


What is Bi-Directional?
Ans: By Using Parent POJO class Object data if we are able to access the associated child POJO class Object/ Object data and alse reverse is  possible than it is called Bi-Directional Association.

Note: inverse="true" attribute of these tags allows to enable Bi-Directional Association relationship

inverse="false" attribute of these tags allows to enable Bi-Directional Association relationship




No comments:

Post a Comment