Broken order by type

Description

Query
SELECT id FROM CallProject obj ORDER BY type(obj) desc

generates SQL
"select callprojec0_.UUID as col_0_0_ from BO callprojec0_ left outer join CALL_PROJECT callprojec0_1_ on callprojec0_.UUID=callprojec0_1_.UUID where callprojec0_.discr in ('INCOMING', 'OUTCOMING') order by callprojec0_.discr"

So no DESC in "order by" in generated SQL

relates to

Activity

Christian BeikovFebruary 3, 2021 at 2:23 PM

Ok, I think I reproduced the issue and have a fix for it as well:

Christian BeikovFebruary 3, 2021 at 1:18 PM

Could you try to set a breakpoint into org.hibernate.hql.internal.antlr.SqlGeneratorBase#orderExprs on line 1152 which should be:

out( e.getType() == SQL_TOKEN ? ordExp : renderOrderByElement( ordExp, ordDir, ordNul ) );

I guess this could be the issue, but I’m not 100% sure. The related issue which caused the change is HHH-14201

Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created November 27, 2020 at 12:29 PM
Updated March 3, 2021 at 11:01 AM
Resolved February 3, 2021 at 4:03 PM