Hibernate Envers has a very specific configuration setting which controls whether or not the optimistic locking field annotated by the @Version annotation is tracked. The name of this configuration property is org.hibernate.envers.do_not_audit_optimistic_locking_field and by default it is true. This means that we do not audit this field. If you enable this to false, then the field will be tracked.
I do want to caution that when the field is tracked, we treat it like any other basic attribute. That means if the original value differs from the value in the persistence context when the persistence operation occurs, that will trigger an audit row insert (even if no other field’s value changed in the entity). This behavior is quite common when using LockModeType#OPTIMISTIC_FORCE_INCREMENT. But if you aren’t doing anything like this, you won’t see any difference in behavior.
@Naros i guess that in 4 version of hibernate-envers there is no functionality for version column, because in AUD table added REV and REV_TYPE columns. In main table of my entity version column is okey, problem is occours only in AUD table
@Naros I am using 5.3.7 version. Changing ‘do_not_audit_optimistic_locking_field’ to false doesn’t work.
As per AuditedPropertiesReader, isDoNotAuditOptimisticLockingField’s ‘true’ value is only being checked for version. So, setting this field value to false doesn’t work. Can you please confirm if there is any latest version where this works?