I am looking for a way to configure nhibernate so that orphans are automatically deleted, but if the parent is deleted and the child exists, a request is made to delete the parent, but not for children. Basically, I would like to configure my cascading parameter as "save-update-orphan", but this is not supported.
<set name="children" inverse="true" cascade="all-delete-orphan" access="field"> <key column="ParentId" /> <one-to-many class="Parent" /> </set>
The all-delete-forph syntax does not work for me, as it automatically deletes the children when the parent is deleted.
Update To try to be clearer ... When I explicitly delete a child from the parent collection, I want the child to be deleted. When I explicitly delete a parent, I do not want the children to leave.
source share