title: Using Hibernate query : colon gets treated as parameter / escaping colon
body: <pre><code>return sessionFactory.getCurrentSession().
              createQuery("FROM Weather WHERE city_id = :id AND date " +
                      "BETWEEN now()::date AND now()::date + (:days - 1)").
                      setInteger("id", city_id).setString("days", days).list();
  </code></pre>
  
  <p>getting error:</p>
  
  <pre><code>org.hibernate.hql.ast.QuerySyntaxException: unexpected token: :
  </code></pre>
  
  <p>How can I use this syntax in HQL? </p>
  
  <p>Basically the problem is that I want to use colon(:) in my query, but when hibernate sees colon, it thinks that it is a paramter(:parameterName is syntax for parameters in HQL), as you can see from my 2 uses(<code>:id and :days</code>).</p>
  
  <p>But when I am using now()::date statement, it is specific postgreSQL syntax, hibernate ruins everything.</p>