Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get back the object

 
kaushik saha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have customer table. Its primary key will be generated by the system. When i update the customer value object using hibernate
(code follows............)

this.hibernateTemplate.saveOrUpdate(customerData);

Now i want to get back on that particular object . Actually i want the primary key of that object .(Before updation i can not get the pk. )

So what will be the HQL for getting back the object ?


kaushik


 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the save, the customerData.getId( or whatever the primary Id is named as) should hold the generated value.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!