title: QueryDSL conditional order by
body: <p>I would like to translate native sql such as:</p>
  
  <pre><code>ORDER BY (currency = 'EUR') DESC, money DESC
  </code></pre>
  
  <p>into query dsl:</p>
  
  <pre><code>.orderBy((qItem.currency.eq("EUR")).desc(), qItem.money.desc());
  </code></pre>
  
  <p>However it throws:</p>
  
  <pre><code>org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: = near line 4, column 31
  ...
  order by qItem.currency = ?1 desc]
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>Edit:
  <strong>Answer (java)</strong></p>
  
  <pre><code>NumberExpression&lt;Integer&gt; currency = new CaseBuilder().when(qItem.currency.eq("EUR"))
              .then(1)
              .otherwise(2);
  
  query.orderBy(currency.asc(), qItem.money.desc());
  </code></pre>