7 Replies Latest reply on Aug 7, 2012 9:33 AM by Adam Warski

    Best way to create an audit history table for a specific entity with one revision per row?

    Thorsten Kunz Novice

      I am looking for a way to display an audit history table for a specific entity incl. a way to highlight the modified fields for each version. Retrieving all versions for a specific entiey already works and I can render a dataTable from it like this:


      final List<Node> nodeList = new ArrayList<Node>();
      final List<Number> versions = getAuditReader().getRevisions(Node.class, selectedNode.getId());
      for (final Number number : versions) {
           final Node node = auditReader.find(Node.class, selectedNode.getId(), number);


      So this works fine and I can easily use this in an audit history table where each row is a revision of the entity.

      Now I set org.hibernate.envers.global_with_modified_flag to true in order to track in the revision table what properties changed from version x to y. My question is now is there a built-in way to query a list of maybe property names that have been modified from version x to y for entity z  with ID n.

      The intention is to use this information in a dataTable and hightlight the modified fields in each row of the audit history so that the user can quickly identify modified properties.