views:

26

answers:

1

When i delete some object (or remove it) from a collection (such as list) and call SaveOrUpdate from the parent of this collection the row of the child isn't removed but updated by setting the foreign key value to NULL.

How can i force it to be deleted (the child row).

+1  A: 

You need to mark the collection as the inverse side of the relationship and set the cascade setting to all-delete-orphan. NHibernate is attempting to update the foreign key to null because you have created an orphan by removing it from the collection but haven't instructed it to delete orphans.

Jamie Ide