-->
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.  [ 2 posts ] 
Author Message
 Post subject: Deleting child
PostPosted: Wed Oct 29, 2003 4:09 pm 
Newbie

Joined: Wed Oct 15, 2003 3:20 pm
Posts: 9
Location: Montreal
Hi I have a group which contains a set of groupReports. When I do a session.delete(group), Id like all its child to be delete as well but it seems to send an update on the child table instead of a delete.
Here is my mapping

--------------Parent
<class name="cgix.trust.domain.PtbnGroup" schema="PTBN" table="PTBN_GROUP" dynamic-update="true">
<id column="GROUP_ID" name="groupId" type="java.lang.Long" unsaved-value="null">
<generator class="sequence" >
<param name="sequence">PTBN_SEQ_G</param>
</generator>
</id>
<set name="groupReports" table="PTBN_GROUP_REPORT" lazy="false" cascade="delete">
<key>
<column name="GROUP_ID" not-null="true" />
</key>
<one-to-many class="cgix.trust.domain.PtbnGroupReport"/>
</set>

-------------Child
<class name="cgix.trust.domain.PtbnGroupReport" schema="PTBN" table="PTBN_GROUP_REPORT">
<composite-id unsaved-value="none">
<key-property column="GROUP_ID" length="22" name="groupId" type="java.lang.Long"/>
<key-property column="REPORT_ID" length="22" name="reportId" type="java.lang.Long"/>
</composite-id>
<version
column="LAST_MODIFICATION_DATE"
name="lastModificationDate"
type="java.sql.Timestamp"
/>

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 29, 2003 7:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is a FAQ.

use unsaved-value="any" or implement Interceptor.isUnsaved()


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

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.