private static final String SEQUENCE = "my_seq";
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQUENCE)
@SequenceGenerator(name = SEQUENCE, sequenceName = SEQUENCE)
private Long titId;
This creates the following schema:
CREATE SEQUENCE my_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1000
CACHE 1;
Observation:
When I set current value
of the sequence to 1, then the first @Id
autogenerated is 50
. When I set the value to 1000
, the first id is 50000
.
So, somehow the current valuze of the sequence always gets multiplied by 50
. Why? How can I prevent this and just use the nexval from the sequence?