Reputation: 655
We load POCO using nhibernate, close the session and then update it (add items to bag or change some properties) and finally create a new session and update it.
How does NHibernate know how to update the changes? (maybe something like select and compare the updated item with the previous one?)
Upvotes: 0
Views: 111
Reputation: 42497
When you use Merge
or the likes, it will attempt to resolve the persistent object with one it already knows about, and if it doesn't, it will load it from the database. At that point, NHibernate has the load state, as well as the current state, and will compare the values between the two states to see if it is dirty. If it is dirty, it can/will flush the changes.
Upvotes: 1