I want to use a binary expression in the order by clause of my hql. I can do what I want in mySql using it's own sql syntax but I could't find any way of achieving the same result in hql.
The sql that I run on mySql server is as follows:
Code:
select .... order by ((`status` = '1' or `status` = '2') and starred = 'Y'), sendtime desc;
The messages that are evaluating the binary expression true are returned before all other message rows in mysql.
I write something like
Code:
order by ((m.status = '1' or m.status = '2') and m.starred = 'Y'), m.sendtime desc
in my hql but It gives a syntax error.
Is there any way to do something similar in hql?