title: How does the JPA @SequenceGenerator annotation work
body: <p>I am learning JPA and have confusion in the <code>@SequenceGenerator</code> annotation.</p>
  <p>To my understanding, it automatically assigns a value to the numeric identity fields/properties of an entity.</p>
  <p><strong>Q1.</strong> Does this sequence generator make use of the database's increasing numeric value generating capability or generates the number on its own?</p>
  <p><strong>Q2.</strong> If JPA uses a database auto-increment feature, then will it work with datastores that don't have an auto-increment feature?</p>
  <p><strong>Q3.</strong> If JPA generates numeric value on his own, then how does the JPA implementation know which value to generate next? Does it consult with the database first to see what value was stored last in order to generate the value (last + 1)?</p>
  <hr />
  <p><strong>Q4.</strong> Please also shed some light on <code>sequenceName</code> and <code>allocationSize</code> properties of <code>@SequenceGenerator</code> annotation.</p>