Make default audit behavior of extending a mapped-superclass with an embeddable consistent with extending with an entity

Description

JPA only allows an entity to extend a mapped-superclass, but Hibernate
provides an extension that allows an embeddable to extend a
mapped-superclass.

The bug is that the default audit behavior of a mapped-superclass depends on the context in which it's used. It should be be consistent, regardless of the context it is used.

Assume we're using AccessType.FIELD and there are no AuditOverride(s).

In the following, the declared fields of A are audited; the fields declared
in B are not audited. In this case, it doesn't matter if the subclass (A)
is audited, the default for the mapped-superclass is that it will not be
audited.

In the following all declared fields in A are audited, including the
embeddable 'b', and all fields in B and AbstractB are also audited. In
other words, the default for the mapped-superclass depends on whether the embedded field is audited.

The behavior when an embeddable extends a mapped-superclass should be made consistent with the behavior when an entity extends a mapped-superclass.

In other words, a "global" @Audited should not have an effect on fields/methods from mapped-superclasses. To audit them, either the mapped-superclass (or its relevant fields/methods) should be audited, or an @AuditOverride should be used.

Environment

None

Assignee

Chris Cranford

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure