Hi
I have a one-to-many association between the classes Parent and Child. The mapping sets the cascading action to all-delete-orphans, to delete the Children which don't have a Parent anymore.
But, this setting also deletes the Children which are assigned to a different parent: I remove the Child from its Parent's collection, add it to the collection of the new Parent, and finally set the Parent property of the Child to its new parent. When flushing the session, the cascade mechanism detects that the Child has been removed from its first Parent's collection, and tries to delete it since it considers it as an orphan.
However, the Child is not an orphan, it just has been adopted by another Parent.
Is that intended NHibernate behavior, or am I missing something?
Thank you! Jonas
|