Hi,
I have a parent table Parent which has many to many mapping with the Child table and I also have the Parent_Child table that stores the parent_id and child_id following is the hibernate mapping defined.
<class name="Parent" table="Parent"> <id name="Parent_id" type="long"> <column name="Parent_id"> </id> <set inverse="true" table="Parent_Child" cascade="save-update"> <key> <column name="Parent_id"/> </key> <many-to-many entity-name="Child"> <column name="Child_id"/> </many-to-many> </set>
When I save the parent it inserts the record into the parent table and child table but does not store anything in the Parent_Child table. I want records to be inserted in the parent,child and parent_child table. What is the best way to do so in hibernate.
Thanks, Bkhe
|