Skip to content
Advertisement

Hibernate not allowing to increment by 5 in sequence

I have following db sequence

Java

However with Hibernate I am getting following error which says hibernate is expecting increment by 50. Why is so?

Edit1 Added java code.

Advertisement

Answer

The error message is quite clear. You have enabled (or not disabled) schema validation, so when the application starts Hibernate is comparing the database with what it expects from annotations and/or configuration. The phonebook_id_seq sequence is defined with an increment of 5 in the database but the annotation says 50 (or says nothing and has a default value of 50). Change the annotation to match the database or change the sequence or disable validation.

I’m guessing that validation is enabled with spring.jpa.hibernate.ddl-auto=validate based on the tags, but without seeing your code it is hard to tell for sure.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement