9 Replies Latest reply on Jun 3, 2011 9:46 AM by ibenjes

    RelationTargetAuditMode.NOT_AUDITED and @OneToMany

      Hi,

       

      I'm having a hard time getting RelationTargetAuditMode.NOT_AUDITED to work on a @OneToMany relationship. Is this supposed to be supported?

       

      In my case Entity A is marked @Audited and has a @OneToMany to the not-audited entity B, e.g.

       

      // in entity A (A is @Audited)

      @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
      @OneToMany(mappedBy = "a")

      public Set<B> getBs()

       

      // in entity B (B is not marked as @Audited)

      @ManyToOne(
      @JoinColumn(name = "a_id")
      public A getA()

       

      This causes a MappingException in the AuditMetadataGenerator.getReferencedIdMappingData() method: "An audited relation from A to a not audited entity B"

       

      I'm using Envers 1.2.2 GA

       

      Dirk