Envers entities with @OneToMany relationshipd with @OrderBy fail to read in 5.4.14

Description

Migrating from Hibernate /Envers 4.3.8 to 5.4.14 one thing breaks consistently is
reading an envers revision of my entity at specific revision where the entity has @OneToMany (bidirectional with mappedBy) with @OrderBy under any of the two conditions:
1. @OrderBy includes a ID of the "many" entity
2. @OrderBy includes a field of many entity which is itself a relation (@ManyToOne) it does not seem to matter if that field points to an audited entity or has targetAuditMode = RelationTargetAuditMode.NOT_AUDITED

Doing removing @OrderBy from @OneToMany or using any regular field (not matching conditions mentioned above) of the "many" entity works fine it just its ID and ManyToOne relationship fields that fail

for example

*Engagement *entity has

Where

reading it

with

Thank you,
alex

Environment

JDK 1.8

Assignee

Chris Cranford

Reporter

Alex Roytman

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

4.3.8

Components

Affects versions

Priority

Critical
Configure