-->
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: Do NOT delete orphan in one-to-many
PostPosted: Tue Sep 20, 2011 6:51 pm 
Beginner
Beginner

Joined: Fri Nov 24, 2006 10:33 am
Posts: 42
Sorry if this is a daft question but it's late and my brain is mush right now.

I've got a one to many relationship.
When I remove one of the child records from my parent's collection, I *dont* want the orphan to be deleted.
I want the child to stay in the database, but with the foreign key to the parent (which is nullable) set to null (or zero or anything that doesn't point back to the parent).

On the collection (bag) I've got cascade='save-update' rather than 'delete-orphan'.

I thought that would do it.

Or am I using one-to-many wrong and I should be using a many-tomany for this?

Thanks


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.