-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Facing problem in composite key used as forgien key
PostPosted: Tue Feb 14, 2012 5:29 am 
Newbie

Joined: Wed Dec 07, 2011 1:35 pm
Posts: 2
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.