title: PostgreSQL and Hibernate java.io.IOException: Tried to send an out-of-range integer as a 2-byte value
body: <p>I have hibernate query:</p>
  
  <pre><code>getSession()                     
          .createQuery("from Entity where id in :ids") 
          .setParameterList("ids", ids)
          .list();
  </code></pre>
  
  <p>where ids is Collection ids, that can contain a lot of ids.
  Currently I got exception when collection is very large:
   java.io.IOException: Tried to send an out-of-range integer as a 2-byte value
  I heard that postgre has some problem with it. But I can't find the solution how to rewrite it on hql.</p>