Wrong SQL generated for JoinedSubclass inheritance with explicit discriminator, reference to intermediate class

Description

With a inheritance hierarchy A > B > C, a association referencing B and explicit discriminators enabled the generated load statement wrongfully selects the discriminator column from B instead of A.

AbstractEntityPersister.propertySelectFragmentFragment:
addDiscriminatorToSelect( select, tableAlias, suffix );

where tableAlias is the alias for the referencedEntity table that, in this constellation, does not match the root table which holds the discriminator column.

Environment

None

Assignee

Unassigned

Reporter

Moritz Bechler

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure