I have an existing db with the following schema and sequence:
CREATE TABLE public.my_table
(
id bigint NOT NULL,
...
CONSTRAINT travelit_hotels_pkey PRIMARY KEY (id)
);
CREATE SEQUENCE public.my_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 500791
CACHE 1;
My @Entity
mapping makes use of the sequence:
@Id
@GeneratedValue(generator = "my_seq")
@SequenceGenerator(name = "my_seq", sequenceName = "my_seq")
private Long id;
As of hibernate-5
, I'm using the following property:
hibernate.id.new_generator_mappings=true
Result: when I create a new entity, it gets the following id assigned: 500744
.
Which is < START of the SEQUENCE, and already exists in my postgres
DB!
Why?