Below is my Primary column definition,
@Id
@GenericGenerator(name = "kaugen", strategy = "increment")
@GeneratedValue(generator = "kaugen")
private Long entityId;
@Version
@Column(unique = false, updatable = true, nullable = false)
@NotNull
private Long entityVersion;
I've two application servers connected to a single database. When 1st application server inserts some 10 records the primary key value(entityId) would be 10 and when 2nd application server inserts some 15 records the primary key value(entityId) would be 25. So far good.
Now when the 1st application server tries to insert some records the entityId starts from 11 instead of 26 resulting in Violation of PRIMARY KEY constraint. Expected is entityId should start from 26.
Both application servers run in separate JVM.
Kindly share your inputs in handling this scenario.
Thanks in advance..