below method not able to handle concurrency and throwing exception (NHibernate.StaleObjectStateException: Row was updated or deleted by another transaction)
In hibernate xml i am using <version name="DBVersion" column="DBVersion" type="Int64" generated="never" unsaved-value="0"/>
public void Save(Object o) { try { // Check to make sure a session has been started, if not open a new session if (_session == null) _session = GetSession(); // Connect to the DB if necessary ReconnectDBConnection(); // Start a transaction BeginTransaction(); // save _session.SaveOrUpdate(o); // commit CommitTransaction(); } catch (NHibernate.StaleStateException e) { string msg = "DB Stale data error. Reason: " + e.ToString(); //show error message throw new ExceptionDatabaseStaleData(msg, e); }
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nhusers/36bc7658-1965-4429-95a4-b8ed9b9451ab%40googlegroups.com.