Reputation: 8875
for reference I'm using version 2.1.2.4000 of Nhibernate.
I've spent pretty much an hour or so reading up the difference between Merge() and SaveOrUpdate() and no explanation attempts to just answer a really simple question??
I know that Merge() will do all the magic to synchronize the detached objects with cached or out of date instances.
BUT, once I've "merged", and I do not intend to change the entity any longer...
Do I have to Still Call SaveOrUpdate?
cheers
Upvotes: 1
Views: 1305
Reputation: 1126
Check another thread. The point is that Merge() just puts together states from the session (from the database) and your detached object. You then should not use detached object any more but use newly returned object from the session that was merged. This object, of course, has to be "saved or updated" in order to persist changes because it has changed due to Merge operation.
Upvotes: 3
Reputation:
Answer here: NHibernate - Difference between session.Merge and session.SaveOrUpdate?
Upvotes: 0