0 Replies Latest reply on Jun 8, 2015 4:23 AM by Michał Szynkiewicz

    Audit entity only if it's aggregated by entity of a given type/auditing subclasses of not audited classes

    Michał Szynkiewicz Newbie



      In our app we have an Address entity. It's used in multiple places. In one of these places we need to audit it.


      In other words, when address is a property of, say, object of class A, we want it audited. In other cases we don't.


      Is there a way to achieve it using envers?



      I tried creating a superclass for Address and then subclassing it with AuditedAddress and UnauditedAddress, but it didn't work.

      When Address (the superclass) is marked as @Audited, it also audits the UnauditedAddress (no matter what combination of annotations I put on the UnauditedAddress).

      When Address is not marked as @Audited it always complains that the AuditedAddress is audited, but its superclass: Address is not.

      As I understand the documentation - it should work with: @AuditOverride(forClass = Address.class, isAudited = true), put on AuditedAddress, but the error is the same.


      Is there a way to achieve my goal without having two entirely separate classes, without any inheritance, for it?