andy
andy

Reputation: 8875

Do I need to call SaveOrUpdate() after calling Merge()?

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

Answers (2)

Petr Kozelek
Petr Kozelek

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

Related Questions