Uploaded image for project: 'Hibernate ORM'
  1. HHH-8268

Partial auditing with MappedSuperclasses


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: 4.0.1
    • Fix Version/s: None
    • Component/s: hibernate-envers
    • Labels:
    • Environment:
      Jboss-as-7.1.1.Final with hibernate-core-4.0.1.Final and hibernate-envers-4.0.1.Final on Oracle 10g (
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
    • Sprint:


      Here's the basic situation: All our entities consist of two parts: one @MappedSuperclass (called <Entity>Base) which holds all properties including the relations (along with the appropriate JPA annotations) + getters and setters and the actual @Entity (class name <Entity>) which holds additional business methods. Why we're doing it this way? So that we can generate the base classes (along with other stuff that we need) out of a metamodel.

      Now we only want to audit some of the entities, but just can't get the relations to work out fine. What we've tried so far:

      1. a) Only annotating the actual entities with @Audited. Then Envers doesn't do anything.
      b) Adding the @AuditOverride annotations. Then Envers rejects the relations as these are pointing to the real entities (not the base classes) and some of them are not audited.

      2. a) Adding the @Audited annotations to the base classes along with @Audited(target=NOT_AUDITED) to the relations. Again, Envers is not really interested in this and just doesn't do anything.
      b) Adding @Audited and @AuditOverride to the real entities again. Then we have the same complaints about not audited entities in relations.

      3. Instead of annotating the attributes, we tried it with the methods so as to possibly override these in the real entity classes. This already upsets the JPA validation, as the attributes are of the real entity types and it claims the relationship's mappedBy-attribute is pointing to the wrong type.

      See the discussion here: https://community.jboss.org/thread/224168?tstart=0




            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created: