Hi,
I got a web solution (aspx) that uses nHibernate.
Im using the same nHibernate session for all users that means i only create one session and then reuse it.
My problem is when i have the same object open in two different tabs in ex. Crome when i update the object on one of the pages i get the "a different object with the same identifier value was already associated with the session"
My update function looks like this now: public virtual void Update(object entity) { ValidateSession(); if (entity == null) return;
var ownTrans = !Session.Transaction.IsActive; if (!Session.Transaction.IsActive) Session.Transaction.Begin(); try { Session.SaveOrUpdate(entity); if (ownTrans) { Session.Transaction.Commit(); } } catch (Exception exp) { if (ownTrans) Session.Transaction.Rollback(); throw (exp); } }
Any ideas to what i have done wrong?
Regards, Jacob
|