Skip to content Skip to sidebar Skip to footer

Message -"could Not Read A Hi Value - You Need To Populate The Table: Hibernate_sequence"

My problem is as follows: When i create POST request in 'Postman' app. This is what i try to POST {'name': 'John Doe', 'email':'jdoe@test.com', 'city': 'London'} I am getting t

Solution 1:

If you are creating a schema using spring boot for local database and jpa is configured to do a auto create-drop, ideally you wont be facing this situation.

spring.jpa.hibernate.ddl-auto=create-drop

But in staging/production you want to handle your schema definition (DDL) separately so hibernate_sequence needs to have an initial value and 0 should suffice for start. It tells the program library from which number to start the auto-generation id.

spring.jpa.hibernate.ddl-auto=validate

INSERTINTO<schema_name>.hibernate_sequence (next_val) VALUES (0);

The above one works for MYSQL

Solution 2:

You can add

spring:jpa:hibernate:ddl-auto: create-drop 

in your application.yml file or application.properties file Do this only when you have truncated table or else you can add INSERT INTO <schema_name>.hibernate_sequence (next_val) VALUES (1);

Solution 3:

Your hibernate_sequence table is wrong.

See 2.6.10. Using identifier table:

createtable hibernate_sequences(
    sequence_name VARCHARNOTNULL,
    next_val INTEGERNOTNULL
)

Solution 4:

drop the table and re-create with next_val as primary key

Post a Comment for "Message -"could Not Read A Hi Value - You Need To Populate The Table: Hibernate_sequence""