-->
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 DELETE in unidirectional ManyToOne
PostPosted: Wed Jun 09, 2010 6:51 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
It seems like a lot of other people had the same problem, but I wasn't able to find a conclusive resolution.

Is there a way to configure @ManyToOne annotation to cascade deletions from parent to children without having to use a @OneToMany on the parent side?

Thanks.


Top
 Profile  
 
 Post subject: Re: Cascade DELETE in unidirectional ManyToOne
PostPosted: Thu Jun 10, 2010 5:39 am 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
i don't think that this is possible. how should Hibernate know that you want to cascade deletions from parent to child if you don't tell it with an @OneToMany? an @OneToMany on the parent side tells Hibernate to replace the Set (or whatever kind of collection you are using) with a PersistentSet which tracks changes made to the collection and therefor being able to cascade those changes.

but i may be wrong. or maybe i didn't grasp your problem. :)


Top
 Profile  
 
 Post subject: Re: Cascade DELETE in unidirectional ManyToOne
PostPosted: Thu Jun 10, 2010 11:34 am 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
Well, Hibernate manages persistent objects. So it knows about their properties, annotations and relationships. I am sure Hibernate builds some sort of dependency graph between classes that it manages and can cascade DELETE from parent to child even if the child is annotated and parent is not. I am sure there are many ways to implement it.

It would be nice to hear some feedback from the Hibernate team.

Thanks.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.