In application which I'm currently developing I have data structure:
Bucket [1] ------ [Many] Element Now I have view when I can add remove and modify elements. Now i have situation when multiple user are editing same bucket, and they can messed up other's edit. I want to solve this problem by checking and updating bucket version each time when data is saved.
JPA has own version, so I plan to reuse that. But JPA willingly does not updates Bucket version when its element was updated. Is there a good way how to enforce version update on entity in JPA?
Currently I found some suggestion, like create dummy field, have own version field, or detaching and merging entity. Non of them seems right to me, is it anything better?
I'm using eclipse link with spring data if this helps.