-->
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: how to get the recently inserted id in hibernate using MYSQL
PostPosted: Wed Jun 06, 2007 7:21 am 
Newbie

Joined: Wed Dec 27, 2006 2:25 am
Posts: 9
Location: Chennai-India
please let me know how to get the recently added id through mysql hibernate object...

thanks in advance

--
Logu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 8:08 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

I can't understand what you want.

But i think this is the thing what you want.


HibObject obj=new HibObject();
obj.setSomeValue("some"); // this is a field not a id

trans =session.beginTransaction();
session.save(obj);
trans.commi();


so after commit() you can get id from obj.getMyId();

you should use your getter for id propery.


Amila

(Don't forget to rate if helps)


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.