• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieve Entity's Auto-Increment Id

 
Yiorgos Panayiotakis
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a rather common problem I think. I want to retrieve my Entity's next (auto-incremented) id without actually persisting the entity.
How is this possible to retrieve an auto increment key before persisting to the database ?

Do i need to use any special annotation on the Entity's id for this purpose ?

Btw I'm using mysql 5 as the underlying database.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
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!