At work, we\'re developing a RESTful application where the data layer will be handled by Hibernate. But we\'re not sure how to handle updates on entities.
We\'re pla
Your strategy is good. Simply copy the version number coming from the client into the loaded entity (or use merge()
, which will do the same), and when Hibernate flushes the entity, if the version number has been incremented, you'll have an optimistic lock exception.
You don't need to check anything by yourself. Hibernate does the check for you.