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.  [ 3 posts ] 
Author Message
 Post subject: Cascade type recommendation
PostPosted: Tue Apr 01, 2008 9:53 pm 
Newbie

Joined: Tue Apr 01, 2008 9:40 pm
Posts: 3
Hi experts,

I need recommendation for cascade type. I'm confuse when choosing between: all, save-update, etc.

Primary, I'm set default cascade as save-update for all my mapping. Is there any tips?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 2:35 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have a look at the parent/child example in the documentation:

Code:
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/example-parentchild.html


There's a good introduction to cascading lifecycle. I can't give you a recomendation, because usage of this heavily depends on your requirements.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 3:55 pm 
Newbie

Joined: Tue Apr 01, 2008 9:40 pm
Posts: 3
I already know about all cascade function. But I want to ask everybody something like

Code:
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#objectstate-transitive


especially,

Code:
Recommendations:

    *

      It doesn't usually make sense to enable cascade on a <many-to-one> or <many-to-many> association. Cascade is often useful for <one-to-one> and <one-to-many> associations.
    *

      If the child object's lifespan is bounded by the lifespan of the of the parent object make it a lifecycle object by specifying cascade="all,delete-orphan".
    *

      Otherwise, you might not need cascade at all. But if you think that you will often be working with the parent and children together in the same transaction, and you want to save yourself some typing, consider using cascade="persist,merge,save-update".


but in NHibernate style.

I confuse when choosing one of them

Any ideas? Is true that default-cascade is bad?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.