This recipe will extend the previous initial audit pattern to allow for historical audit recording. This allows for more detailed logs of who made the change, when the change occurred, and the change itself. This recipe implements a JPA Lifecycle Change Listener in order to log all CRUD operations.
Building upon the previous recipe, we start with a customer, and we want to audit all CRUD operations that occur. In addition to using
@PreUpdate annotations, we need to create two new entities to implement a JPA Lifecycle Change Listener.
Using a JPA Lifecycle Change Listener is more in depth, but allows for a more historical audit report to be kept. If you need more than just the most ...