I try to make myself 'comfortable' with the
Java eco-system as JPA and Hibernate.
I have for instance made a class employee with sequence:
I can CRUD records with Postman is working perfectly.
But now I have inserted records with SQL (INSERT INTO table name ()).
Now I try to insert a record with postman, I get the error message:
rg.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.ADDRESS(ID) [1, 'town name', '0', 'street name']"; SQL statement:
I think that's due that I add records by SQL statements. Hibernate 'thinks' the sequence is still one and I can imagine that it goes wrong.
In the 'real (=production)' environment, what is than the best way to implement this?
Defining the complete schema with Liquibase/flyaway for example and simply define sequence as:
And are there some more 'little' things where I need to have tobe where off?