2 Replies Latest reply on Jun 10, 2017 6:02 PM by Chris Cranford

    @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) vs @NotAudit

    manuel iborra Newbie

      Hi everyone!

      I try to audit an entity but I don't want to audit its relationships. If I put @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) in @ManyToOne relations, this works and I don't have any exception, but when I try to use the same annotation in a @onetomany with the param mappedby defined, I have an exception that says me that I have to audit the other entity.


      @Table(name = "OWNERS")




      public class Owner {


        @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)


        private User user;


        @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

        @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner" )

        private Set<Pet> pets = new HashSet<Pet>();