javax.persistence.SequenceGenerator and Allocation Size
<p>We all know the default behavior of Hibernate when using @SequenceGenerator - it increases real database sequence by one, multiple this value by 50 (default allocation Size value) - and then uses this value as entity ID. So the first questions is why the hibernate multiplies the sequence number fetched from database with allocation size ?????</p>

<p>Second how to get rid of constraint violation exception in case when Spring/Hibernate application and ETL job is inserting the data in same table at the same time ?</p>

<p>Also the huge gap in sequence values in table are seen, what is the solution for this also.</p>

<p>Just for reference we are using following annotation in application to generated the values of primary key column using sequence defined in Oracle database :</p>

<pre><code>@Id
@SequenceGenerator(name = "seqGenerator", sequenceName = "SEQ_table1")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGenerator")
private Long id;
</code></pre>