title: HQL order by criteria
body: <p>I met a problem with SQL.</p>
  
  <p>Assume this is my native SQL:</p>
  
  <pre><code>SELECT * FROM products 
  ORDER BY balance &lt;= bottleneck DESC, product_code ASC
  </code></pre>
  
  <p>This is working at postgressql. But it doesn't work with HQL. My HQL as following:</p>
  
  <pre><code>from Products as p order by  p.balance &lt; p.bottleneck desc, p.productCode asc
  </code></pre>
  
  <p>And I met exception as following:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: &lt; near line 1, column 67 [from com.inventory.inventory.vo.Products as p order by  p.balance &lt; p.bottleneck]
      at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
      at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
      at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
      at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:261)
      at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
      at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:101)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:80)
      at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:98)
      at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
      at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
      at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1760)
      at com.inventory.inventory.dao.impl.ProductsDAOImpl.getProducts(ProductsDAOImpl.java:72)
      at Main.main(Main.java:43)
  </code></pre>
  
  <p>Is any way to solve for this query?</p>
  
  <p>Your help is much appreciated.</p>
  
  <p>Thanks,
  Best rgds,
  A1ucard</p>