-->
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: Help with cascade/circular issue
PostPosted: Wed Oct 05, 2005 4:24 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
Hi,

We are using hibernate 3.0.x and I need some help trying to figure out how to properly handle a circular issue in hibernate.

I have a legacy model like:

A (1 - n) B
A (1 - n) C (1 -1) B

So, I have a parent class that has two collections of objects. The objects in the second collection contains the objects in the first collection through a has-a relationship.

Here is my issue:

If I define B as a set before C, I can save A and the cascade properly save the objects. If I try to delete A, the B's are deleted before the C and the delete fails because the reference to B in C is not satisfied.

If I define C before B, the delete works correctly, but the insert fails because B is not saved and I get a foreign key constraint.

So, I guess my real question is (if you can understand my cryptic example), is there a way to define it so that B is inserted before C and C is deleted before B?

chuck


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.