In my spring project, tables in the database are automatically created by Hibernate using my entity classes as the database, but I manually insert some default values ββinto the table (using pgAdmin3).
In this regard, before this, I ran into this problem: when I try to insert a value through Java code into one of the tables that already have values, an error message appears saying that the primary key already exists in the database.
Does anyone know how to solve this problem?
UPDATE
How I declare my primary key in my class:
@Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.AUTO) private int id;
source share