funny you mention it. I am doing this out of the "hibernate in action" book. I do know about the thing you mention already.
That was a very good point. I did such a thing on the add and forgot to do it on the remove but I am confused on one last minor detail.
The only change I made was between all-delete-orphan to delete-orphan and I am trying to understand why the behavior changed when I don't have the code that I should and will add(ie. just looking for understanding here as I read the book)
I understand now I think why delete-orphan does not work. The orphan child still has a reference to it's parent, so it is not really an orphan, more like a half orphan as it is not in the set...ie. The bidirectional relationship was not cleaned up properly by me.
Then my question becomes why in the world is all-delete-orphan working...The only difference here is it adds save-updates to be cascaded also. I haven't changed the child object, just removed it from the collection. How is it that all-delete-orphan is behaving differently then delete-orphan? Bottom line...I expected the same behavior which as you point out should not be to erase it from the database as I did not clean up the bidirectional relationship properly.
thanks,
dean
|