I need help on hibernate mapping.
I have a table “A” having primary key “A_ID”. And this “A_ID” primary column of table “A” is foreign key as well as primary key both in table ”B” .
That is “A_ID” is primary as well as foreign key (referencing table ”A”) in table “B” .
And “A_ID” in table “A” is created using a sequence “UNIQUE_ID_SEQUENCE”.
So my doubt is while making A.hbm.xml , I will be mapping primary key column “A_ID” of table “A” something like this
Correct me if I am wrong anywhere …
<id name="aid" type=”int” column="A_ID" >
How will I be mapping primary key here ? Same as above ?
And moreover as A_ID is foreign key as well primary key in table “B” then should I provide foreign key mapping in B.hbm.xml also (provided the same column “A_ID is mapped as primary key also in B.hbm.xml”) ?
And what about using sequence inB.hbm.xml ?