I have problem with mapping two class This is my parent class
<hibernate-mapping> <class name="com.mercer.vo.CommentingAdminContentVO" table="COM_CLIENT_CONTENT"> <composite-id name="commentingAdminContentPK" class ="com.mercer.vo.CommentingAdminContentPK"> <key-property name="clientId" type="java.lang.String"> <column name="CLIENT_ID" /> </key-property> <key-property name="contentId" type="java.lang.String"> <column name="CONTENT_ID" /> </key-property> </composite-id> <property name="contentURL" type="java.lang.String"> <column name="CONTENT_URL" /> </property>
<set name="comSet" inverse="true" cascade="all-delete-orphan" lazy="false" fetch="select" batch-size="5" > <key> <column name="CLIENT_ID"/> <column name="CONTENT_ID"/> </key> <one-to-many class="com.mercer.vo.CommentingContentModeratorVO" /> </set> </class> </hibernate-mapping>
This is child class
<hibernate-mapping> <class name="com.mercer.vo.CommentingContentModeratorVO" table="COM_CONTENT_MODERATOR" > <cache usage="read-only" include="all" /> <id name="id" type="java.lang.Long"> <column name="ID_CONTENT_MODERATOR" /> <generator class="increment" /> </id> <property name="clientId" type="java.lang.String"> <column name="CLIENT_ID" /> </property> <property name="contentId" type="java.lang.String"> <column name="CONTENT_ID" /> </property> <property name="moderatorId" type="java.lang.String"> <column name="MODERATOR_ID" /> </property> </class> </hibernate-mapping>
Parent class is mapped to child class with one-many relation. Mapped Column is composite key.
When I am trying to delete parent record, it gets deleted but child records associated with parent are not getting deleted. Also, There are no exceptions thrown in back end.
I have tried with all-delete-orphan option in mapping set. Can anybody help on it?
|