Throw an exception when a mapped superclass is queried

Description

The attached test case works, giving the SQL:

select concrete2x0_.entityId as col_0_0_ from CON2 concrete2x0_ order by concrete2x0_.entityId ASC

select concrete1x0_.entityId as col_0_0_ from CON1 concrete1x0_ order by concrete1x0_.entityId ASC

and a warning: HHH000180: FirstResult/maxResults specified on polymorphic query; applying in memory!

Limits are not specified in the test case, regardless, this can be done in the database as:

(select entityId from CON2
union all
select entityId from CON1)
order by entityId ASC

And even with limits and sort conditions it can be done as:

select * from (
(select * from (select entityId from CON2 order by entityId ASC) where rownum <= 10)
UNION ALL
(select * from (select entityId from CON1 order by entityId ASC) where rownum <= 10)
) where rownum <= 10 order by entityId ASC

and also more generally with LIMIT and more sort columns, I believe.

Environment

Windows 7 Professional SP1, Oracle 12c, jdk-8u73-windows-x64

Assignee

Unassigned

Reporter

Nikolas Andersen

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure