May 2016
Beginner
204 pages
4h 22m
English
Hibernate, since version 4, fully supports entity versioning, and it's called envers. This is very useful for keeping track of changes to each audited entity. In this section, you will see how to configure envers, choose the right strategy for entity auditing, and handle associated entities.
The first thing you need to do is to add the appropriate JAR and class path to your project. Hibernate envers are packaged separately, so you'll have to add the Maven dependency:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>${envers-version}</version>
</dependency>Once you have resolved the jar dependency, you could simply add the @Audited annotation to the entity that you wish to track: ...
Read now
Unlock full access