There is already some data available in table, where id being the primary key for me. So when i trying to invoke my spring jpa code to add values to the table i'm using @GeneratedValue for the primary key.
But this way is generating value which is already present in DB. so my application is throwing an exception.
Is there any way i can get the current value from the table and increment my primary key id wrt the previous value of ID present in the table
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "id", updatable = false, nullable = false) private int id;