I have hibernate query:
getSession()
.createQuery("from Entity where id in :ids")
.setParameterList("ids", ids)
.list();
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.
The exception occurs because of PostgreSQL's limit of 32767 bind variables per statement. As a possible workaround try to split your large query into smaller ones.