My Entity contains Long id
attribute and i get JSON request from user with id
value,
When i tried to save it first time, it saving, and when i tried to use same id
in JPA save method, it is saving also. I use the below,
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id", unique = true)
private Long id;
and i tried with the below,
@Table(name = "Person",
uniqueConstraints={
@UniqueConstraint(columnNames = {"id"})})
also not working. My request JSON as below, and if i use the same JSON for next request also saving.
{
"id":1,
"name":"John"
}