interesting.... cause after i figured out the "multiple references of same row" problem - it worked.
The front end has a screen with all the parents and children and lets you mix them up however you want (re-assign children etc...)
I was doing something like this:
Code:
foreach child on screen
is parent new?
no? do nothing
yes? child.parent = manager.GetParent(id);
loop
as you can see the problem with this is that GetParent returns new instances every time -- so when the second child of the same parent comes along he gets the same parent but in a different instance... now put all these children in a collection and call the manager.SaveKids(childCollection) - which does everything in one transaction and you've got problems....
ALL i did to get this to work was this:
Code:
parents = getAllParents();
foreach child on screen
is parent new?
no? do nothing
yes? child.parent = parents.find(id);
loop
walla - this works fine. But I never explicitly remove the child from the former parent collection - and it still works... maybe because i am persisting the children in the end with SaveKids (as opposed to SaveParents) ...
hrmmmmm