This has nothing to do with identity.
IMO an application should take care of application things.
And a database should be allowed by the application to do what it is built 
to do.

But I also see nHibernate is playing in a lot of different database 
playgrounds.  
So that must be a challenge working with the very many different nuances of 
all the very many DBMS.


 

On Tuesday, March 1, 2016 at 7:59:41 PM UTC-5, Oskar Berggren wrote:
>
>
>
> 2016-03-01 18:49 GMT+00:00 Steve Lyle <[email protected] <javascript:>>:
>
>> 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