I have this HQL, which works fine when I'm using 3.3.2.
This is not the exact table/class name of course, but the structure is the same.
Code:
select distinct oc.ce
from com.xxx.Asdf as oc
where
oc.ce.Road.Main.id = :id and
oc.ce.Road.Ind = :ind
order by oc.ce.Number asc, lower(oc.ce.Text) asc
but after I upgrade to 3.5 and also try it with 3.5.1,
the HQL was translated to this sql:
This is not the exact table/column name, I cannot put the real name here.
Code:
SELECT DISTINCT ce1_.ID AS id29_,
ce1_.fk_id AS fk2_29_,
ce1_.text AS title3_29_,
ce1_.dur AS duration4_29_,
ce1_.number AS seq5_29_,
ce1_.unit AS duration6_29_,
ce1_.fee AS per7_29_
FROM ceAsdf map0_,
ce ce1_, ---------- same table repeated twice
ce ce2_, ---------- same table repeated twice
ceraft map3_
WHERE map0_.fk_id = ce_.ID
AND map0_.fk_id = ce.ID
AND ce2_.fk_d = map3_.ID
AND map3_.fk_id = ?
AND map3_.ind = ?
ORDER BY ce2_.seq_number ASC,
LOWER (ce2_.title_text) ASC
Notice that the
Code:
ce ---------- same table repeated twice
table is repeated twice.
This causes problem since the ordering is using ce2, but ce2 was never in the select statement.
Code:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2297)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
at org.hibernate.loader.Loader.list(Loader.java:2167)
Truncated. see log file for complete stacktrace
java.sql.SQLException: ORA-01791: not a SELECTed expression
Anyone have any idea about this?
Should I submit a bug report?