Once a record is inserted in the database, we can update it any number of times. The versioning feature of hibernate is useful when we want to know how many times a particular record has been modified. This feature is useful in sensitive applications in the finance domain, where we need to record each and every data movement.
When we use the versioning feature, hibernate inserts the initial version number as zero. Whenever a record is modified, the value of the version is increased by one.
To work with the versioning concept, we have to make a small change in the POJO. We have to create a field with the numeric type and declare this field with the
@version annotation so that hibernate will consider it to be the versioning column.