Java - JPA - Generators - @SequenceGenerator

Posted by Yatendra Goel on Stack Overflow See other posts from Stack Overflow or by Yatendra Goel
Published on 2010-04-07T19:00:38Z Indexed on 2010/04/07 19:03 UTC
Read the original article Hit count: 225

Filed under:
|

I am learning JPA and have confusion in the @SequenceGenerator annotation.

Upto my understanding, it automatically assigns a value to numeric identity fields/properties of an entity.

Q1. Does this sequence generator make use of the database's increasing numeric value generating capability or generates the number on his own?

Q2. If JPA uses database auto increement feauture, then will it work with datastores that don't have auto increement feature?

Q3. If JPA generate numeric value on his own, then how the JPA implementation knows which value to generate next? Does it consult with the database first to see what value was stored last so as to generate the value (last + 1).

======================================================================================

Q4. Please also throw some light on sequenceName and allocationSize properties of @SequenceGenerator annotation.

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa