4 Replies Latest reply on Apr 11, 2013 9:25 AM by Stig Runar Vangen

    RelationTargetAuditMode.NOT_AUDITED to Audited entity

    Peter Eigenschink Newbie

      I have two entities, A and B, both of them audited. A has a bidirectional OneToMany-Relation to B. When I call getA() on B I want to get the latest A from the A table (not A_AUD), so I annotate getA() with "@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)".

      In code(-snippets):


      // Entity A

      @OneToMany(mappedBy = "b", fetch = FetchType.LAZY)

      public List<B> getB() {

           return b;



      // Entity B

      @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

      @ManyToOne(fetch = FetchType.LAZY)

      public A getA() {

           return a;



      But what I now actually get when I call getA() is the A out of A_AUD at the given revision.

      Is there a way to get the most recent version of A out of the actual table?