I have implemented a solution of Hibernate Envers.
I am extending RevisionLister by creating my own class to store the system username:
import org.hibernate.envers.RevisionListener;
public class CustomRevisionListener implements RevisionListener {
public void newRevision(Object revisionEntity) {
CustomRevisionEntity revision = (CustomRevisionEntity) revisionEntity;
revision.setUsername(System.getProperty("user.name")); // for testing
}
}
This does the job, but what I want to do, is to make a more comprehensive record, that would include the table name being audited.
Does anyone know how I could do this. I cannot find any documentation relating to recording the table name?