Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 807011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:20:12+00:00 2026-05-15T00:20:12+00:00

I am already using Hibernate Envers to audit entities that are updated by a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:20:13+00:00Added an answer on May 15, 2026 at 12:20 am

    I haven’t tested this out yet, but I am simply doing the following:

    @RevisionListener(SystemRevisionListener.class)
    @Entity
    public class SystemRevision extends AbstractRevision
    {
       @Column(nullable = false, updatable = false)
       protected QuartzTriggerHandle job;
    
       @Column(nullable = false, updatable = false)
       protected Class jobClass;
    
       ...
    }
    
    
    
    @RevisionListener(WebRevisionListener.class)
    @Entity
    public class WebRevision extends AbstractRevision
    {
       @ManyToOne(optional = false)
       @JoinColumn(nullable = false, updatable = false)
       protected HttpRequest httpRequest;
    
       ...
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table using an enum. This is already working with hibernate
I am developing a tool that handles some database entities using JPA2, with hibernate
I am using Hibernate with JPA annotations. I have a one-directional many-to-many association that
Using Hibernate 4.0 I have three hibernate entities: Song, CoverArt, CoverImage Songs represents music
i need to retrieve the page title from an URL i already have using
Our team is growing, but we're also growing specialized. We've already been using ticketing/bug
I have a Java webapp using Hibernate and MySQL. If the site isn't used
I am trying to design an entity model using JPA2.0 via hibernate. I have
I have two tables named USER and ROLE with entities as USER and ROLE
I know that this issue was already raised here several time. However I couldn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.