I am already using Hibernate Envers to audit entities that are updated by a user through the UI; however, I also have asynchronous jobs running in the background and would like to audit those as well using Envers. Now, for the UI, I track which HttpRequest made the change which gives me the date, user, session, etc. For the background jobs, I would like to track the date the job was run as well as the exact job that modified it (job class).
Is it possible to setup 2 Audit entities, 1 for the UI, and 1 for the system changes?
Walter
I haven’t tested this out yet, but I am simply doing the following:
Then, in each listener, I do whatever I need to do to set these properties. I should now be able to track how an entity as modified, if a user did the change (and what request it is tied into), or if the system changed the entity, what job is responsible for the change. I would be storing more properties in the SystemRevision than this, most likely the arguments and method name.