Bagagem wrote:That's a classical concurrency control problem... It will arise in any language, not only in BPEL... You can solve it by using optimistic or pessimistic currency control... See link bellow for reference...
Now, what is the best approach to avoid incoherent data in the database?
If the process bpelProcess1 is invoked twice in a row, both instances of the process perform the select, searching for the same row - and none of them will get any data. Therefore both follow to the insert process. Only one of them should insert, the second one should already find it in the database.
Pessimistic concurrency control (or pessimistic locking) is called "pessimistic" because the system assumes the worst — it assumes that two or more users will want to update the same record at the same time, and then prevents that possibility by locking the record, no matter how unlikely conflicts actually are.This will definitly happen, I can't assume otherwise.