Hibernate version: 3.1
Name and version of the database you are using: Oracle 10g
Hi, I have composite primary key both in parent and child. Parent and child have one to many relationship. Upon inserting, parent record is successfully inserted but child is not getting inserted. Neither I see any exception. Following is my mapping:
Code:
<hibernate-mapping>
<class name="ParentClass" table="Parent">
<composite-id name="id" class="parentId">
<key-property name="parentCol1" type="long" column="parentCol1"/>
<key-property name="parentCol2" type="String" column="parentCol1"/>
</composite-id>
<property .....
<list name="childrenList" inverse="true" lazy="true" cascade="save-update" table="Child">
<key>
<column name="childCol1"/>
<column name="parentCol1"/>
<column name="parentCol2"/>
</key>
<index>
<column name="parentCol1"/>
<column name="parentCol2"/>
</index>
<one-to-many class="ChildClass"/>
</list>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="ChildClass" table="Child">
<composite-id name="id" class="childId">
<key-property name="childCol1" type="integer" column="childCol1" />
<key-property name="parentCol1" type="long" column="parentCol1"/>
<key-property name="parentCol2" type="String" column="parentCol1"/>
</composite-id>
<property .....
<many-to-one name="parent" class="ParentClass" insert="false" update="false">
<key>
<column name="parentCol1"/>
<column name="parentCol2"/>
</key>
</many-to-one>
</class>
</hibernate-mapping>
Any help will be greatly appreciated.
Thanks.