posted 9 years ago
Hi,
i am developing a web application using spring boot and spring data jpa (hibernate). I implemented optimistic concurrency using the @Version annotation. My domain object has the field "version" (int) and that annotation. Also i added the version to my database. If i create my entity using my frontend it writes the entity successfully to the database with the version 0. Then i am editing my entity using my frontend and submitting the changes. The data are submitted successfully to the database again and the version is 1. Looks good...but now...if i change my entity again (like before) i get an StaleObjectstateException and no data are submitted to the database. Do you have any idea? Of course, if two users are changing the data the StaleObjectstateException is thrown. Thats exactly what i want, but here i am working only with one user and i expect, that one user can always change the data and the version changes.
Cheers
pascal