title: HQL - conditional WHERE clause based on column
body: <p>I'm rather new to <code>HQL</code> and I'm trying to add a <code>WHERE</code> clause to my hql query in order to only apply a filter in case one of the columns has a certain value. I've read about the <code>CASE WHEN</code> statement and I'm trying to use it, but apparently I'm doing it wrong because I get a syntax error on the query.</p>
  
  <p>What I've tried is the following:</p>
  
  <pre><code>FROM myClass WHERE CASE WHEN col1 = :val1 THEN dtIns &gt;= :dt1 ELSE true END
  </code></pre>
  
  <p>Ideally, what I want to do is apply the filter <code>dtIns &gt;= :dt1</code> only when <code>col1</code> has a certain value, otherwise I don't want to apply any filter.
  The server responds with:</p>
  
  <pre><code>QuerySyntaxException: unexpected token: &gt;=
  </code></pre>
  
  <p>Can anyone tell me what I'm doing wrong?</p>