what exactly is going inside Nhibernate.ISession SaveOrUpdate

398 Views Asked by At

I am using MVC, NHibernate and Sharp architecture for my project.
Whenever I am saving objects(entities) using SaveOrUpdate there are child entities which are updated as well. But instead of updating child entities it runs DELETE-INSERT for all the child entities.

any help.

1

There are 1 best solutions below

3
On

It happens because you are not updating existing child objects, you replace whole collection of them. That makes Nhibernate think that it has to save new collection.