title: Spring JPA + Boot +Sequence Generator always 0
body: <p>The following code only renders an ID of 0</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy=GenerationType.AUTO, generator="PROJECT_SEQ_GEN")
  @SequenceGenerator(name="PROJECT_SEQ_GEN", sequenceName="X.X_PROJECT_SEQ", allocationSize=1)
  private long projectId;
  </code></pre>
  
  <p>I tried <code>SEQUENCE</code> and <code>AUTO</code> but both with the same result. <code>x_project_seq.nextval</code> works fine in my Oracle database. I would like to keep using the sequence already defined in the database. </p>
  
  <p>According to the Getting Started guide by Spring - <a href="https://spring.io/guides/gs/accessing-data-jpa/" rel="nofollow">Accessing Data with JPA</a> ...</p>
  
  <p>"The Customer’s `id property is annotated with @Id so that JPA will recognize it as the object’s ID. The id property is also annotated with @GeneratedValue to indicate that the ID should be generated automatically."</p>
  
  <p>From their example it looks like all they did was create <code>new Customer</code> and the IDs were automatically generated. What am I missing here? </p>