Getting consecutive version numbers from Hibernate's @Version usage once per transaction
- by Cheradenine
We use Hibernate with the following version definition for optimistic locking et. al:
<version name="version" access="field" column="VERSION" type="long" unsaved-value="negative"/>
This is fine and dandy; however, there is one small problem, which is that the first version for some entities is '0', and for others, it is '1'.
Why this is…