I having a code like this 

```
 (case app.test when 2 then ''  end) as tested

```

I am trying to get count of this app.state so written like this after referring to this document <http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#queryhql-aggregation>

```
 count (case app.test when 2 then 'tested'  end) as tested

```

After this I getting error like 

```
unexpected token: case 

```

Any idea

But the same statement is working mysql

```
COUNT(CASE WHEN app.test= 2 THEN "tested" END) 'tested',

```