title: JPQL: boolean expression in CASE WHEN needs explicit comparison with TRUE/FALSE?
body: <p>I had tried the following:</p>
  
  <pre><code>SELECT NEW com.kawoolutions.bbstats.view.ScheduleGameLine(
      ga.id                                                                      AS gid
    , ga.scheduledTipoff                                                         AS scheduledtipoff
    ...
    , sch.finalScore                                                             AS homefinalscore
    , sca.finalScore                                                             AS awayfinalscore
    , CASE WHEN pah.wasWithdrawn OR paa.wasWithdrawn THEN TRUE ELSE FALSE END    AS waswithdrawn
    )
  </code></pre>
  
  <p>Last line is important. According to</p>
  
  <p><a href="https://stackoverflow.com/questions/4972369/jpql-hql-and-jpa-hibernate-boolean-expression-in-select-constructor-expression-n">JPQL/HQL and JPA/Hibernate: boolean expression in select constructor expression not working (unexpected AST node: AND, NPE, HqlSqlWalker.setAlias)?</a></p>
  
  <p>the CASE WHEN is needed. However when running this, Hibernate fails with</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: . near line 19, column 18
       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:124)
       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:1770)
       at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
  </code></pre>
  
  <p>It obviously isn't supported by JPA/Hibernate's grammar, but as Java and DB programmer I'd expect such expressions to work, like if ( hasHitHard ) ... and/or SELECT was_withdrawn...</p>
  
  <p>Why has it been made this way or why isn't it supported as I expected?</p>