How can I order by a specific property order in HQL?
For MySQL I can use: SELECT * FROM question q ORDER BY q.status IN ("DONE", "NO_ACTION"), q.status IN ("NEW","SAVED"), q.created DESC
but HQL doesn't allow in
in order by
.
Am I missing something? Is there some other way around this problem?
Tha开发者_运维百科nks
It seems to me that MySQL syntax using ORDER BY xxx IN (XXX,XXX...) is not SQL-ANSI supported function, it's a specific MySQL function.
So you should figure out another way to do what you want, by not using this function.
You can find here all the function supported by HQL.
Not to revive a dead question, but
SELECT * FROM question q ORDER BY q.status IN ("DONE", "NO_ACTION"), q.status HAVING q.status IN ("NEW", "SAVED")
Find "having clause"
精彩评论