Hibernate SEQUENCE is generating multiple entries in sequence table on application restart

Viewed 17

I am using the below sequence generator.

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "publisher_id_seq")
@SequenceGenerator(name = "publisher_id_seq", sequenceName = "publisher_seq", initialValue = 100)
private Long id;

when I am restarting the application multiple time , 100 is inserted multiple times in the publisher_seq table. I can see the multiple rows in publisher_seq table.

next_val 100 100 100 100

This is creating problem when I am going to update my entities.

0 Answers
Related