Hello,
I have a "small" question about how nhibernate works. Im programming an ASP form with a parent-child persistent class. Then parent class have IList associate to a bag in the xml mapping and define with cascade="all-delete-orphan" parameter.
In the form i show the parent details and a gridview with the IList elements, the user can modify the fields in the gridview. The user have the option to cancel the modifications, and for it, i create a temporary object and save the changes in the parent´s childlist. I save this object in the asp session until the user press the button cancel or update. If cancel the form reload the object and if press save execute SaveorUpdate(tempobject).
And now my question:
It works!!, nhibernate save/update or delete the columns but the problem is this: first of all it always execute an update for the parent object and all of the childrens independently of that the children is modified or not and then insert/update/delete the childrens.
I test it without store the tempobject in asp session and it works perfectly.
I use the NHibernate Best Practices system to manage nhibernate sessions and i think the problem is when i try to save a object with a session diferent than i retrieve from the BD, nhibernate think that all lines are changed.My question is only to confirm this, and if anyone have other idea to do it.
Thanks for all (and sorry for my english xD)
|