Question

Does JPA provides any specification for Auditing entities.

The issue is currently we are using Hibernate envers to audit an entity in our application. I want to move out of this and implement a solution which is generic across ORM layer. as it is just for auditing purpose I have to use Hibernate API in my application

Was it helpful?

Solution

I don't think there is anything in the specification but... if you are using the Hibernate implementation of JPA you could likely use the Envers project with your configuration. Had a look and sure enough there is a guide to do so:

Auditing JPA entities with Hibernate Envers

OTHER TIPS

A useful feature in the JPA specification for auditing is Entity Listeners. However prior to version 2.1 you could not use injection in them. As of version 2.1 CDI is supported

Hibernate supports JPA 2.1 in version 4.3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top