-->
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: cascade="all-delete-orphan" with sort not working
PostPosted: Mon Mar 08, 2004 8:39 am 
Newbie

Joined: Fri Oct 17, 2003 10:02 am
Posts: 2
I have a piece of code which has a set with a cascade="all-delete-orphan". But as soon as I add a sort="Comparator" the cascades stop working.
The cross reference gets set to null and orphans are not deleted.

It works fine without the sort on the set!??

I tried a work arround with the comparator in the setter or getter creating
a new collection and sorting but this does not work as you are not allowed to dereference a collection with "all-delete-orphan". Is this a bug or am I doing something wrong!

Mapping:

<class name="com.core.risk.Control" table="Control">
<cache usage="read-write"/>
<id name="id" type="long" column="controlId" unsaved-value="-1">
<!--Hibernate Unique Key Generator-->
<generator class="sequence">
<param name="sequence">HIBERNATE_SEQ</param>
</generator>
</id>
<property name="description" column="description" type="com.riskgovernance.dao.hibernate.LongStringType"/>
<property name="name" column="controlName" type="string"/>
<property name="cost" column="cost" type="double"/>
<one-to-one cascade="none" name="baseCost" outer-join="true" access="field" />
<set name="auditData" table="AuditData" cascade="all-delete-orphan" sort="com.core.AuditDataComparator">
<key column="objectId"/>
<one-to-many class="com.riskgovernance.core.AuditData"/>
</set>
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 9:01 am 
Newbie

Joined: Fri Oct 17, 2003 10:02 am
Posts: 2
Sorry my mistake just discovered it was because I was sorting by date and
never returned 0 from comparator. to avoid losing duplicates and this obviously fails when hibernate tries to remove the object from the collection.


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.