Home > other >  Hibernate increases DB sequence by 50000
Hibernate increases DB sequence by 50000

Time:10-22

Originally Hibernate inserted new values with ID starting from 50. But after redeployment the new IDs are 50050, 50051 etc.

Why so? How do I configure it to increment by 1 always?

DB is Oracle.

Sequence's SQL:

create sequence my_seq increment by 1 cache 1000;

Column setup:

@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGeneratorMySeq")
@SequenceGenerator(name = "seqGeneratorMySeq", sequenceName = "MY_SEQ")
private Long id;

CodePudding user response:

Answer found here In short: set up sequence params (like increment, cache size, etc) in the Entity class, not only in DB

  • Related