I am using Spring 3.0 + JPA2 + Hibernate 4.1 with MySQL 5.5
I am looking to record 5 fields in my tables for audit trail purposes – lastModifiedByUser, lastModifiedTime, createdByUser, createdTime, isActive
I am not deleting any data from the tables, just marking them off as isActive false.
What is the best tool to help me record these audit fields in my tables ?
I am wondering if DB triggers are not the best idea, specially since modifying / creating user name is also recorded.
Check out Envers, it’s built just for this and is part of Hibernate 4.x. You just add an @Audited annotation to your class and it automatically handles versioning of your entities.