1 Reply Latest reply on Mar 22, 2017 12:53 PM by Chris Cranford

    Version Maintenance Based On Row

    Manoj Sherkhane Newbie

      I need to maintain versioning for every row of table. Is It possible using hibernate envers.Envers works in a similar way but revision number is incremental in all actions and its database based.

        • 1. Re: Version Maintenance Based On Row
          Chris Cranford Newbie

          Yes, the revision number that Envers generates is global in the system but I don't understand how that impacts your requirements.

           

          You can configure your entities to include a @Version annotated numeric/timestamp field to represent the unique-row version maintained by Hibernate and Envers will track that property just like any other audited property.  By default Envers will not audit these fields and aren't included in the Envers schema; however, you can alter that behavior should you require it by using the configuration property org.hibernate.envers.do_not_audit_optimistic_locking_field and setting it to false.  By setting this to false, your audit query results will include the specific version hibernate assigned to that row during the various persist / merge / remove operations performed.