I'm using JPA/Hibernate and postgres as my DB
I created a sequence in postgres like this:
CREATE SEQUENCE player_sequence
INCREMENT 20
START 1;
I want Hibernate to use the above sequence for primary key.
The id part of the entity is:
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "player_seq")
@SequenceGenerator(name = "player_seq", sequenceName = "player_sequence", allocationSize = 20)
private Integer id;
When I create a new player and try to save it via EntityManger.persist method I get the following error:
Hibernate: select next_val as id_val from player_sequence for update org.hibernate.id.enhanced.TableStructure$1$1 execute ERROR: could not read a hi value org.postgresql.util.PSQLException: ERROR: column "next_val" does not exist
I don't understand what I do wrong
EDIT:
Here is content of persistence.xml:
