Skip to main content

HIbernate @version for existing data, cannot be null

Hibernate have option to check concurrent modification of a same data. Which will be easy when we add a version column in the table and hibernate entity.


If existing row has version as NULL then hibernate will throw the NullPointerException while updating the existing data.

To avoid this exception  @version column  should be NOT NULL and should have a default value. if it number 1.

Comments