java - Hibernate Inconsistent generated Id -


i have main method sequentially call 2 web-services. first web service first insert data request table have primary key sequentially generated using hibernate. table have 1 status field initial status "received". first web service,process request , change status "processed".

now main method call second web-service fetch request status "processed". calling main method sequential, second web-service call can have 1 entry in status "processed". after this, main method sleep 5 second , process repeat infinitely. when fetch record changing status "completed".

also web-service's accessing db remotely. data consist 1 requestid(this not primary key).

so problem when process continue 1 hour see there inconsistency in requestid send , receive. these id didn't match. , can see there multiple entries status remain processed. using hibernate id generator increment while testing system in multiple cluster faced uniqueconstraint exception. started using sequence generator, , facing issue.

do need use flush after commit?


Popular posts from this blog