title: HQL count statement
body: <p>I having a code like this </p>
  
  <pre><code> (case app.test when 2 then ''  end) as tested
  </code></pre>
  
  <p>I am trying to get count of this app.state so written like this after referring to this document <a href="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#queryhql-aggregation" rel="nofollow">http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#queryhql-aggregation</a></p>
  
  <pre><code> count (case app.test when 2 then 'tested'  end) as tested
  </code></pre>
  
  <p>After this I getting error like </p>
  
  <pre><code>unexpected token: case 
  </code></pre>
  
  <p>Any idea</p>
  
  <p>But the same statement is working mysql</p>
  
  <pre><code>COUNT(CASE WHEN app.test= 2 THEN "tested" END) 'tested',
  </code></pre>