I have a hibernate entity with an ID configured as
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
The creation of new eleme
If you use AUTO, Hibernate will choose one of the strategies to generate your id. From the Reference:
AUTO - either identity column, sequence or table depending on the underlying DB.
So you have to see the ids being generated to see which strategy Derby is using. Although it looks like, it resets the generator everytime you restart your app. Try setting
<prop key="hibernate.hbm2ddl.auto">update</prop>
You could quickly fix it using a sequence generator though. Like:
@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator="my_seq_gen")
@SequenceGenerator(name="my_seq_gen", sequenceName="ENTITY_SEQ")
private Long id;
Where ENTITY_SEQ is the name of the sequence in your database (you create one manually).