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

sequence on Insert

 
Chris Spierings
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have defined an hbm file where I have a key handled like this:

<id name="id">
<generator class="sequence">
<param name="sequence">id_seq</param> </generator>
</id>

Right after I do the insert I need that if back for future use and since its the unique key for the table I don't have the means to read it and ensure that I get the correct row.

Any ideas if this can be done without taking control of the creation of the key values?

Thanks,

Chris
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You can call the getId() method on your POJO.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!