Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: mystery of many to many
PostPosted: Fri Jun 27, 2008 11:35 am 
Newbie

Joined: Tue Jun 24, 2008 6:42 am
Posts: 19
Hello everybody

I have a Child with two parents, and if I delete a single parent and the Child is also deleted, yet it remains a parent, so it is not an orphan! it should not be deleted!

my mapping:

[code]
<set name="friends" sort="unsorted" table="lien" lazy="true" cascade="all,delete-orphan">
<key Column="pere"/>
<many-to-many class="test.Node" column="enfants"/>
</ set>
[/ code]

Do not tell me that Sun has not thought about this possibility in removing cascade?

Bye


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2008 11:07 am 
Newbie

Joined: Wed Jan 23, 2008 10:38 am
Posts: 1
If i no wrong, u use property in cascade is all and delete-orphan, that's mean u use all property of cascade like save-update and persist too..

and if u delete parent of cource your parent will be deleted and the child too.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 10:32 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Check out the JavaDoc for the CascadeType. It might shed some light on the situation:

http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/annotations/CascadeType.html

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.