These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Change the NHibernate way to get the Identity value?
PostPosted: Fri Apr 18, 2008 8:56 am 
Newbie

Joined: Wed Apr 16, 2008 9:27 am
Posts: 2
Hi folks! My real problem begin with the MSSQL doesn't have the BEFORE Trigger. So I Had to use a INSTEAD OF Insert trigger, that do what I need before the insert query it self (That it "re-written" into this trigger).

With this, when I go to insert with NHibernate, NHibernate try to request the Identity value with a 'Select Scope_Identity()' that obviously return a NULL value.

Can I change the way of NHibernate get this identity, like using the @@IDENTITY, or a custom select returned by this trigger...

Any helpfull idea it's welcome, thank you very mutch and sorry about the english!

_________________
---
TKs


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 4:25 pm 
Beginner
Beginner

Joined: Wed Jul 19, 2006 8:24 am
Posts: 35
Using @@identity will create a whole different set of issues. That's why scope_identity() is considered the best practice.

From a design standpoint is there a reason you can't move the logic in the trigger to your .net code? If not can you change the generator from identity to an assigned value?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.