Note that there are some explanatory texts on larger screens.

plurals
  1. PONhibernate transaction exception
    primarykey
    data
    text
    <p>I am using Nhibernate in a session-per-request context. When I use session.Update and commit or rollback my transaction, I get an ObjectDisposedException.</p> <p>the stack trace for this exception is: at NHibernate.Transaction.AdoTransaction.CheckNotDisposed() at NHibernate.Transaction.AdoTransaction.Rollback() at MyService.update(MyItem item) in C:\Projects\MyProject\ItemService.cs:line 121 at MyController.Edit(Nullable`1 pageId, MyItem item, FormCollection collection) in C:\Projects\MyProject\ItemController.cs:line 251</p> <p>Before I perform the update the transaction contains the following properties: isActive: true, wasCommitted:false, wasRollBacked: false</p> <p>After I performed the update action the properties have the following values: isActive: false, wasCommitted:true, wasRollBacked: false</p> <p>Why do I get the exception and why do the booleans change without committing ?</p> <p>I am using the following code to perform this action:</p> <pre><code>using (var tx = SessionManager.CurrentSession.BeginTransaction()) { try { //perform update wysiwygitemRepository.Update(item); // perform an action that raises an exception (because of null value) pageSettingService.SaveSettings(null, item.Id); tx.Commit(); } catch(Exception) { tx.Rollback(); } } </code></pre> <p>I used fluhmode.none as flushmode, but also tried flushmode.auto</p> <p>Even if I change the code to the following , I still got the same exception: </p> <pre><code>using (var tx = SessionManager.CurrentSession.BeginTransaction()) { try { //perform update SessionManager.CurrentSession.Update(item); tx.Commit(); } catch(Exception) { tx.Rollback(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload