-->
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.  [ 3 posts ] 
Author Message
 Post subject: Retrieve newly saved object ID
PostPosted: Fri Mar 28, 2008 4:13 am 
Newbie

Joined: Thu Mar 13, 2008 10:40 pm
Posts: 3
Location: Philippines
in inserting new data or object.
I use session.save(objectName);

Does anybody know how to retrieve the ID of the newly saved object???
Or i need the ID of the newly inserted data as the rturn type..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 4:55 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
u get id as return value of method save


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 4:59 pm 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Making it more easier...
session.save(objectName);
session.flush();
Object id = session.getIdentifier(objectName);

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.