title: Hibernate native query optional parameter throws 'operator does not exist: bigint = bytea'
body: <p>I have a query as follows:</p>
  
  <pre><code>SELECT id FROM table1 WHERE (:param IS NULL OR id_or_smth = :param)
  </code></pre>
  
  <p>The <code>param</code> parameter is optional, therefore it can be <code>null</code></p>
  
  <ol>
  <li>I createed a <code>javax.persistance.Query</code></li>
  <li>To which I then <code>setParameter("param", null)</code> </li>
  <li>And when I called <code>getResultList()</code> I got the following error:</li>
  </ol>
  
  <blockquote>
    <p>Caused by: org.hibernate.exception.SQLGrammarException: ERROR:
    operator does not exist: bigint = bytea</p>
  </blockquote>
  
  <p>how can i handle this?</p>