File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Auto ID generation strategy in JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Auto ID generation strategy in JPA" Watch "Auto ID generation strategy in JPA" New topic

Auto ID generation strategy in JPA

bagaria kushal

Joined: Mar 29, 2011
Posts: 19
If we specify id generation strategy as AUTO, the persistence provider chooses one of the following strategies :-

- Table

My question is on what basis or criteria does the persistence provider decides which strategy to be used?
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
This depends on the provider.

By default EclipseLink uses TABLE sequencing. This is because IDENTITY and SEQUENCE require database support, so TABLE is the most platform independent.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
I agree. Here's the link:
subject: Auto ID generation strategy in JPA
It's not a secret anymore!