Hibernate抛出SQLException无法重置阅读器 [英] Hibernate throws SQLException Could not reset reader

查看:150
本文介绍了Hibernate抛出SQLException无法重置阅读器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java.sql.SQLException: could not reset reader
        at org.hibernate.lob.ClobImpl.getCharacterStream(ClobImpl.java:100)
        at org.hibernate.type.ClobType.set(ClobType.java:70)
        at org.hibernate.type.ClobType.nullSafeSet(ClobType.java:141)
        at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2025)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2271)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688)
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)

上面是堆栈跟踪. 它只能处理少量数据,但不能处理大量数据. 我不知道可能是什么问题?

Above is the stack trace. It is working with small amount of data but fails with large data. I cant figure out what could be the problem?

关于, Preet

推荐答案

我们刚刚解决了一个类似的问题,我想在这里描述这个问题,以防万一有人遇到它.请注意,关于同一问题,还有一个另一个问题.我们有Oracle 10,Hibernate 3,Java 1.4和修补的Ojdbc14.我们使用ˇHibernate.createClob(String)ˇ创建了CLOB.大型字符串(〜700KB)上的程序(批处理作业)失败.

We just solved a similar problem and I would like to describe the problem here in case someone encounters it. Note that there is another question about the same problem. We have Oracle 10, Hibernate 3, Java 1.4 and patched Ojdbc14. We created CLOBs using ˇHibernate.createClob(String)ˇ. The program (batch job) failed on large strings (~700KB).

问题在于,在Hibernate中,我们首先使用CLOB插入了实体,并对其进行了更新(包括CLOB).第二个更新是多对一更新的一部分. CLOB在这之间没有变化,只是Hibernate想要对其进行两次更新.并收到了此无法重置"阅读器错误.似乎不能两次使用相同的流.我们通过确保仅将CLOB保存一次来解决此问题.

The problem was that with Hibernate we first inserted the entity with CLOB and the updated it (including CLOB). The second update was a part of many-to-one update. The CLOB didn't change in between, it's just that Hibernate wanted to update it twice. And it got this "could not reset" reader error. It seems that it can not use the same stream twice. We fixed this by making sure that CLOB is saved only once.

这篇关于Hibernate抛出SQLException无法重置阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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