Hibernate Envers automatically integrates with Hibernate ORM and provides a powerful and easy to use solution to write an audit log. As I described in a previous post, you just need to add Envers to your classpath and annotate your entities with @Audited. It will then document all insert, update and delete operations and you can even perform complex queries on your audited data.
Sounds quick and easy, right?
Well, it is, as long as you don’t want to use more than the default functionality. Unfortunately, that’s the case for most real-world applications. You most often need to store the name of the user who performed the changes or you just want to audit operations that meet certain conditions.