chiranjeevi gunturu wrote:Hi,
I got a scenario in many to many association between tables.
I created two tables(TableA and TableB) which are not having primary keys at all.
Now i need to create many to many association to between these two tables. Is this possible ? if yes how to implement that?
Please answer me .
Thanks in advance.
Chiranjeevi
You have to create a new table for many to many association between TableA and TableB, suppose it is TEST_AB and A is POJO for TableA ,B is POJO for TableB.
Then in A.hbm.xml
.......
<set name="tableABSet" table="TEST_AB">
<key column="A.columnInDB" />
<many-to-many column="B.columnInDB" class="B" />
</set>
.......
Then Hibernate will automaticly populate the data into TEST_AB table in DB whenever you add B to A.