1 Reply Latest reply on Oct 26, 2011 3:51 PM by gorf

    NOT_AUDITED issues

    gorf

      I have the following classes:

       

      @Audited

      public abstract class BaseDomain {

       

      }

       

      @Audited

      public class A extends BaseDomain {

       

        private B b;

       

      }

       

      @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

      public class B extends BaseDomain {

       

      }

       

      Basically, I don't want to audit B, but when I retrieve an audited version of A, and try to examine its B object, Envers tries to query the audit table for B (which doesn't exist because I don't want to audit B).

       

      My tables look like this:

       

      TableA

      - aId

      - FK_bId

       

      TableB

      - bId

       

      I've tried adding the following to class A but it still tries to look for B's audit table:

       

      @Audited

      public class A extends BaseDomain {

       

        @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

        private B b;

       

      }

       

       

      I feel like I'm missing something really simple here.  How can I tell Envers that B should not be audited and that when I'm looking at audited versions of A, that it will just get the current contents of B?

       

      Any ideas?

        • 1. Re: NOT_AUDITED issues
          gorf

          Nevermind, I figured it out, duh.

           

          I removed the @Audited annotation on B so that it won't be audited.  Then I added @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) to the B getter in A.  So in the end, my classes look like:

           

          @Audited

          public abstract class BaseDomain {

           

          }

           

          @Audited

          public class A extends BaseDomain {

           

            private B b;

           

            @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

            public B getB() {

              return b;

            }

           

            public void setB(B b) {

              this.b = b;

            }

           

          }

           

          public class B extends BaseDomain {

           

          }