-->
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: all-delete-orphan does insert first and delete later
PostPosted: Fri Oct 30, 2009 10:52 am 
Newbie

Joined: Wed Oct 28, 2009 2:16 pm
Posts: 1
Hi,

I have two entities A and B (names changed). A has Set of B objects. A is mapped to B with <set cascade="all-delete-orphan" inverse="true" ...>.

I want to delete the old Bs and reinsert the new ones.

When I do A.getBs().clear() and A.getBs().addAll(setOfNewBs) , it first INSERTs the new B in DB and then fires DELETE queries. I know this can be resolved by firing flush() on Session after A.getBs().clear(). Is there any other way, I can specify some option so, that Hibernate first deletes the child elements and then inserts new ones. I have a constraint on the child table which checks Sequence Number of B and A's ID.

Thanks in advance for looking.


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.