-->
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: Question about cascade delete
PostPosted: Mon Feb 28, 2005 6:24 pm 
Newbie

Joined: Mon Jan 26, 2004 4:21 pm
Posts: 10
Hibernate version:2.1.7c

Hi everybody,

I have a question regarding cascade=all-delete-orphan

I have a parent/child association that uses cascade=all-delete-orphan.
The child has a column (different from the PK) that has a UNIQUE constraint.

If I remove some children from the parent, add new ones, and save: all children are passed to saveOrUpdate, and the ones that were removed are deleted.
This is what I expected.

Now, if I :
- remove a child
- add a new one with the same unique property as the one I have deleted
- pass the parent to saveOrUpdate

The new child is created before the old one is deleted, causing a 'unique constraint violation'.

Is there a way to make sure the chidren that I removed are deleted before the ones I added are created?

Thanks you,

Susie.


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.