title: QueryDSL enums as result of case when causing ClassCastException
body: <p>I am trying to build a query that returns just an enum value. I thought using a case when would be the right way to go, but I run into the following Exception:</p>
  
  <pre><code>Caused by: java.lang.ClassCastException: org.hibernate.hql.internal.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.internal.ast.tree.SelectExpression
  at org.hibernate.hql.internal.ast.tree.CaseNode.getFirstThenNode(CaseNode.java:44) ~[hibernate-core-4.3.1.Final.jar:4.3.1.Final]
  </code></pre>
  
  <p>This is the query causing the Exception (I tried to abstract it as far as possible to simplify the example (e.count is actually a subquery)):</p>
  
  <pre><code>QEntity e = new QEntity("e");
  
  EnumExpression&lt;EnumType&gt; cases = new CaseBuilder()
      .when(e.count.eq(1)).then(EnumType.ONE)
      .when(e.count.eq(2)).then(EnumType.TWO)
      .otherwise(EnumType.MORE);
  
  new JPAQuery(em()).from(e).where(e.enumType.eq(cases)).singleResult(e.enumType);
  </code></pre>
  
  <p>using QueryDSL 3.6.9</p>
  
  <p>reproduced with QueryDSL 3.7.3</p>
  
  <p>I am not sure if I am using QueryDSL the wrong way or if this is not supported.</p>