I am trying to implement a basic optimistic lock mechanism with a retry interceptor.
So the thing is there is a object Quiz with a property responsesCount. In case that there is a optimistic Lock exception thrown during an update of the quiz, the respective update method will be invoked again from the retry interceptor.
The thing is that something is not right because the retried method has the same version number number every time, and because of this it will fail the transaction no matter what.
version: 10
process A: start update quiz, version 10 process B: start update quiz, version 10 process B: finish update quiz, version 11 process A: optimistic exception thrown raised update quiz, retry process A inside the retried method the version is always 10
What can I do then? It should increment automatically the version in order to success the transaction