Damien
Damien

Reputation: 14057

nHibernate Mapping Issue - Cannot Delete members of a collection

Ok. So the situation is:

Parent Class which has an IDictionary of Child Classes. I wish these child classes to be deleted when the parent class is. This works fine. I also wish to be able to delete members of the child class individually, and this does NOT work.

So my Question is; Why can I not delete these child members?

The error I get is along the lines of:

Cannot delete, Would be readded by cascade

My mapping file in the parent class has a cascade setting of 'all-delete-orphan' while the child class has no cascading defined.

Any idea? Cheers.

Upvotes: 0

Views: 360

Answers (1)

Jamie Ide
Jamie Ide

Reputation: 49251

It would be helpful to see the mappings. But my guess is that you are not removing the child from the parent's collection in addition to deleting it.

Upvotes: 2

Related Questions