Created
April 23, 2010 15:34
-
-
Save ChrisMissal/376694 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var txn = session.BeginTransaction()) | |
{ | |
try | |
{ | |
session.SaveOrUpdate(entity); | |
session.Flush(); // <-- is this even necessary? UPDATE... Not necessary, thanks! :) | |
txn.Commit(); | |
} | |
catch (HibernateException) | |
{ | |
txn.Rollback(); | |
throw; | |
} | |
} |
@benhyr thanks!
Reposting my tweet here.
I spoke too soon. I believe it may be necessary if you've changed the session.FlushMode (I believe it's FlushMode.Auto by default). Otherwise, you may need to manually do the flush in certain cases (likely not if if you're using GUID or HighLow keys but I'm not positive on those)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not necessary. Here's mine: