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

Envers cannot support @IdClass referencing foreign entity identifier

Description

Reference:
https://wiki.eclipse.org/EclipseLink/Examples/JPA/2.0/DerivedIdentifiers
https://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e1112

When using an @IdClass that references another entity (in a One|ManyToOne relationship), the @IdClass should use the type of the primary key of the referenced entity.

This is a completely supported scenario in Hibernate and any JPA compliant provider. However, when you enable Envers for the entity (i.e. make it @Audited), exceptions start to occur as Envers expects the types of the @IdClass to match the same fields in the entity.

I have created a test case and an associated fix in the referenced pull request.

Environment

All

Status

Assignee

Chris Cranford

Reporter

Matthew Morrissette

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.1.0

Priority

Major