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: Difference between CascadeStyles
PostPosted: Sun Mar 09, 2008 2:03 am 
Newbie

Joined: Sun Mar 09, 2008 1:57 am
Posts: 1
Could somebody please tell me what the difference between each CascadeStyle is ? I'm especially looking for the difference between CascadeStyle.All and CascadeStyle.AllDeleteOrphan and also the difference between "CascadeStyle.Delete" and "CascadeStyle.DeleteOrphan"

What I'm seeing is that when I use CascadeStyle.All, if i delete a child from a Parent's child collection and say update on the Parent, it does not really delete the child, but this works fine when you use AllDeleteOrphan .. Also when you say Delete Orphan, when is an object considered Orphan ..

Tried googling the difference between these cascade styles but could not find any useful documentation anywhere.. Any help will be greatly appreciated

Also, could someone give me guidelines on when to use what Cascade Style ("All" /"AllDeleteOrphan" and "Delete"/"DeleteOrphan"))

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 3:42 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
I'm not 100 percent sure, if my explanation is completely correct, but that's the way I understood cascading. With cascade, the operation you apply to the parent is cascaded to the childs. You do an update on the parent, so you get an cascaded update. If you want the child to be deleted, you have to delete the child explicitly or use cascade "AllDeleteOrphan" or "DeleteOrphan".

Have a look at http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/example-parentchild.html. You'll find a pretty good example there. Especially "17.3 Cascading lifecycle".

_________________
--Wolfgang


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.