Tested:
- Postgres:13.1-alpine in Docker
- PostgreSQL 13 in Windows
and also - H2 in-memory database.
I have a table, with 5 fields. The database is created automatically from spring. Here is my entity.
@Entity@Table(name = "people")public class Person implements Serializable {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;private String name;private String address;private String phone;private String email;
for example: I want to update the address field:
The primary key auto_increment in postgres loses its sequence when executing an update, why? How can I prevent its sequence to remain.
The same update was done with H2 memory database and this change in the sequence of primary keys does not happen.
Has anyone else has similar issues?
Does anyone have any suggestions on how to prevent the sequence from going out of sync?
Any advice would be greatly appreciated!
Thanks
Ben