• 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic