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
|