Hibernate: create sequence hibernate_sequence start with 1 increment by 1 statementĪppears in the log, whilst I have initialized the database with two records already. So my question is that: “Shouldn’t be Hibernate get the last id in the database and then append to it?” What is anomalious, is that my previously prepared records were initialized with the ids 1 and 2. I debugged into the code and found that the newly created record would be inserted into the database with the id “1”. It failed with an “org.h2.jdbc.JdbcSQLException: Unique index or primary key violation” exception. After that I tried to persist another one into it, but it failed. So I first initiated the database with an SQL script creating two records in the database. Public class RepoTestClass implements Serializable = GenerationType.AUTO) My try was disturbed though, because the auto incrementation of the annontated id field did not happen right. I tried to use HIbernate with the lovely in memory database of H2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |