I have the following query:
select myentity from TEST as test
left join test.org.parent as parentOrg
left join test.clientRequest as clientReq
where test.customId = 1 and (test.dstatus = 1 or test.cm = true)
order by (case when test.request != '' then test.request else clientReq.name end) asc;
It is working correctly. But I need not only clientReq.name, but also clientReq.surname. Is it possible to combine these two columns in this case when...then...else...end?
Sort of:
order by (case when test.request != '' then test.request else (clientReq.name and clientReq.surname) end) asc;
This exception excludes:
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node
source
share