Hibernate Batch update java.sql.BatchUpdateException Ora-24813 cab = nnot发送或接收不支持的LOB

时间:2016-06-20 22:34:30

标签: java oracle hibernate hibernate-batch-updates

我正在对可滚动结果进行更新并且它一直正常工作但是经过一段时间后,滚动结果变为返回更多结果让我们说超过50条记录,并使用下面的代码显示下面的执行结果。

ScrollableResults serviceScroll = session.createCriteria(SomeService.class).add(Restrictions.in("some values", arraylistofvalues)).scroll();

int count_cursor = 0;

while (serviceScroll.next()) {
                        SomeService serviceRecord = (SomeService) serviceScroll.get(0);

    //some updates here

     session.update(CenterServiceRecord);

                        someEntity test = new someEntity();

                        someEntity.setStatusDate(new Date());

                        session.save(someEntity);
                        session.flush();
                        if (++count_cursor % 10 == 0) {
                            session.flush();
                            session.clear();
                        }
    }



Caused by: java.sql.BatchUpdateException: ORA-24813: cannot send or receive an unsupported LOB

        at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)

如何解决这个问题及其原因?

1 个答案:

答案 0 :(得分:0)

在尝试重新运行代码更改之后我做了解决问题的方法是使批量更小--->来自

  

%10至%5

但不知道为什么会发生这种情况,如果有人知道请改进我的答案。 代码变为" 工作版"

if (++count_cursor % 5 == 0) {
      session.flush();
      session.clear();
  }