Monday 21 January 2008

NHibernate transaction locking oops!

Was testing catching NHibernate.StaleObjectStateException (exception where one user updates a record which another user then attempts to update without getting newer version).

Was getting 'Failed to initialise lazy..." when reloading record on associated collection due to a timeout and also appeared to be locking the server (no queries could be run on tables involved in failed update)

It came down to the transaction not being Rolled-back when exception thrown - so obviously DB still in transaction.