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: Getting the ID of the Last Inserted Record
PostPosted: Fri Jun 20, 2008 7:36 pm 
Newbie

Joined: Tue Jun 17, 2008 3:26 am
Posts: 7
I m kind of new here, but I don't think it is a naive question.
I am trying to figure out if NHibernate would get the ID (identity column in SQL Server, sequence.CurrVal in Oracle) of the object that is recently inserted. So assuming I have a class Employee and create a new instance of it and assign the required values, then persist using NHibernate, would the ID be returned somehow, and if not what is the way to go about solving this?
Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 21, 2008 2:03 am 
Beginner
Beginner

Joined: Thu Nov 29, 2007 4:36 am
Posts: 20
If it's mapped as an identity key - then yes, after saving and flushing the entity will have it's new ID.


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.