2016-03-01 18:49 GMT+00:00 Steve Lyle <[email protected]>:

> The following
>                     txn = ses.BeginTransaction(); //)
>                     ses.Save(employee);
>                     txn.Commit();
>
> throws
>                     IsolationLevel =
> '((NHibernate.Transaction.AdoTransaction)txn).IsolationLevel' threw an
> exception of type 'System.NullReferenceException'
> on the Commit()
>
> But when I profile the SQL server the profile captures a successful SQL
> insert.
> The problem is immediately following the Insert is "select
> scope_identity()" issues by nHibernate.
>     Scope_Identity() returns null to the application because the table I'm
> inserting into has a "instead of insert" trigger.
> I can add the scope_identity() to the trigger, and it is successful is
> capturing and reporting the inserted identity, but the application never
> gets the value.
> So the Commit() rollsbacks my successful insert because of the false
> positive on nHibernate's scope_identity().
>
> What is the workaround to this?
>
>
Can you user trigger-identity instead of identity as generator?
http://nhibernate.info/blog/2009/02/09/nh2-1-0-new-generators.html

/Oskar

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to