Easy question:
Standard Parent/Child relationship, indexed, cascade="all-delete-orphan".
I want to move child C from having parent A to parent B.
I do
Code:
A.getChildren().remove(C);
C.setParent(B);
B.addChild(C);
and everything is fine for the rest of the session.
But, after the session is flushed I find that A has been deleted. I guess this is because "delete-orphan" is doing it's job. Strangely I get no error about C now being in the B.getChildren() collection, and it just disappears from it, with no FK violation.
How does one change a child's parent?
Do I have to turn off "delete-orphan" and manage deletion myself?