Missing Hierarchy subclass in query clause when using treat

Description

With an entity hierarchy as such:

A
B extends A
C1 extendes B
C2 extends B
D extends C1

creating a query using treat:

the generated sql will be:

C1 and B are missing, but should be there, since they are not Abstract.

The culprit is this line of code:
https://github.com/hibernate/hibernate-orm/blob/6acfd17548ac1ccfd9af6404965a8719c94d705c/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java#L635

the subclass should be excluded from the query only if the entity is Abstract

Environment

None

Assignee

Unassigned

Reporter

Michele Preti

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure