zahy wrote:
lookup "cascade = all-delete-orphan "
Hi Zahy and thx for your reply.
Well the thing is I know about delete-orphan and if it was a normal one to many mapping I would know how to set it up but since this child has 2 parents Im not sure how to do it. The problem is that the child will still have an orphan even though I remove the father or the mother but I want it deleted if I delete just one of them.
If I have
Class Mother
List children
Class father
List children
Class Child
Father
Mother
If the mother and father has the child in both their list that means they are the parents to that child.
What is the easiest way to delete a mother and all her children?
Or if I just want all a mothers children deleted how is the easiest way to do that? the only way I know of is to
get mother from db.
Loop her children.
remove link to the childrens father.
Remove link to the childrens mother.
and thats it but it just seems as much code when all I really just want is to