With Hibernate Envers, an entity class Ent annotated with an @Audited annotation will automatically be stored in a table Ent_aud. The Ent_aud table stores revisions of all properties annotated with @Audited or all fields from an entity when the whole class is annotated. It also stores a rev value (global counter), which refers to a row in the revinfo table, holding information such as the timestamp of the revision. We probably can extend its capabilities to store the principal information in the revinfo table, such that we can present a log for a property or entity with revision history including the user responsible for the changes.

Basic example: http://www.javaroots.com/2013/08/how-to-maintain-audit-history-in-db.html

Submitted by Elmer van Chastelet on 21 January 2015 at 10:44

Log in to post comments