PostgreSQL和Hibernate java.io.IOException:尝试发送超出范围的整数作为2字节值 [英] PostgreSQL and Hibernate java.io.IOException: Tried to send an out-of-range integer as a 2-byte value

查看:1093
本文介绍了PostgreSQL和Hibernate java.io.IOException:尝试发送超出范围的整数作为2字节值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有休眠查询:

getSession()                     
        .createQuery("from Entity where id in :ids") 
        .setParameterList("ids", ids)
        .list();

其中id是集合ID,可以包含很多ID. 当前,当收集非常大时,我得到了例外: java.io.IOException:尝试发送超出范围的整数作为2字节值 我听说postgre有一些问题.但是我找不到如何在hql上重写它的解决方案.

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.

推荐答案

发生异常是因为PostgreSQL对每个语句的绑定变量限制为32767. 作为一种可能的解决方法,请尝试将大型查询拆分为较小的查询.

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.

这篇关于PostgreSQL和Hibernate java.io.IOException:尝试发送超出范围的整数作为2字节值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆