-->
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: How to get id of an object when using save function?
PostPosted: Sat Mar 10, 2007 6:26 am 
Newbie

Joined: Mon Mar 05, 2007 3:02 am
Posts: 3
Hi All, i'm a new one in hibernate. And i want to get id of an object after using save() function. Please help me to do this.

thank you so much.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 7:36 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
after saving the value using save method

Object id = session.getIdentifier(valueObject);

you will have ur id:-)

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


Top
 Profile  
 
 Post subject: again!!!
PostPosted: Sat Mar 10, 2007 10:28 pm 
Newbie

Joined: Mon Mar 05, 2007 3:02 am
Posts: 3
thank you, it work well.
But when i try this : id = Object.getId(), it also works.
And I think after you save this object, it becomes attached object. it'll be set id from db to it. so it have an id, and you can get this id through getId() method of this object.

Is it right? please show me!!!

best regard !


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.