-->
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: Child-dependent Cascade Delete?
PostPosted: Thu Sep 24, 2009 10:21 am 
Newbie

Joined: Thu Sep 24, 2009 10:06 am
Posts: 1
Here is my situation - the code I have to refactor uses an ALL and DELETE_ORPHAN casade to delete the children of the parent. However, this has been identified as not always desirable, as the child may be owned by another parent. It is intended that the child should only be deleted if no parents exist for it.

I'm relatively new to Hibernate, and have been unable to find any simple solutions in the documentation. Ideally, DELETE_ORPHAN would only delete children that are truely orphans, not just those disassociated from the new deletion. If there was no Hibernate layer, my first instinct would be to query the database for any references for the child, and if none exist, delete it. Perhaps the solution is through HQL? However, since there are nearly 200 cases of this in the code, a quicker solution would be preferred ;)

Thanks in advance


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.