We're updating the issue view to help you get more done. 

Partial auditing with MappedSuperclasses

Description

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

Environment

Jboss-as-7.1.1.Final with hibernate-core-4.0.1.Final and hibernate-envers-4.0.1.Final on Oracle 10g (10.2.0.1.0)

Status

Assignee

Unassigned

Reporter

Raimund Klein

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.0.1

Priority

Major