@TableGenerator(name=\"Emp_Gen\",table=\"ID_GEN\", pkColumnName = \"GEN_NAME\",pkColumnValue = \"Employee_GEN\",valueColumnName = \"GEN_VAL\",initialValue = 1000,alloc
What it comes to the first value being 1 instead of 1001 that is Hibernate bug HHH-4228, with status Won't fix. Correct first value in your case is 1001 instead of 1000, because initialValue
initializes column that stores last value returned (and not the next value to be returned).
Using following in persistence.xml (as also suggested in bug report) will fix problem with first value:
<property name="hibernate.id.new_generator_mappings" value="true"/>
Meaning of allocationSize
is likely misunderstood in question. It is not step to increment. It means how many values are allocated with one database query from the table. This is rather optimization to avoid additional query every time when id value is needed for new entity.
Side product is that restart of application causes often holes to the sequence: