-->
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: Differences in CascadeTypes
PostPosted: Wed Jul 25, 2012 6:45 am 
Newbie

Joined: Mon Mar 07, 2011 9:46 am
Posts: 10
Hi,

short question:
There seems to be a difference between the CascadeRype.ALL and the List of all singe CascadeTypes ({CascadeType.DETACH ,CascadeType.REFRESH ,CascadeType.REMOVE ,CascadeType.MERGE ,CascadeType.PERSIST }).
Example:
I have 2 Entities, A and B. A has a one to many relation to b, mapped by:
@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "b")
If I call now save on my A Entity, A and the related B Entities are persisted.
If I replace the Annotation with
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.DETACH }, mappedBy = "b")
the b Entities are not persistet, if I call save on A.
So there must be i difference between ALL and the list of alle singe Cascading Types, although the documentation says, that this is the same. Has someone an explanation for this?

Greetings and thanks for your help,
Andreas


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.