Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I move a child of a privately owned collection to a new parent?

415279Jan 11 2005 — edited Jan 14 2005
I have a recursive tree and want to implements a "move to" operation.

I.e. changing the parent reference and adding the node to the privately owned list of children of the new parent.

1: newParent.children.add(moveChild);
2: oldParent.removeChild(moveChild);
3: moveChild.setParent(newParent);

That gives me the right data in the TopLink cache for the UI. However, when I commit the UnitOfWork, the moveChild
is deleted persistently in the second line (privately owned collection). If I comment out the 2nd line, the commit works non-destructively, but the child is with both, the old and the new parent, and the UI is messed up.

[ The reason for keeping the children privately owned is that child and parent are a composite pattern and of the same class. So if I delete a top-node parent, it would cascade-delete the whole tree and with "private collection" TopLink could figure out the right delete order. At least that what I believe so far].

Has anybody had this problem before?


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2005
Added on Jan 11 2005
3 comments
313 views