我在Hibernate中更新表时遇到异常
ORA-24816:在实际LONG或LOB列之后提供的扩展非LONG绑定数据
- Update table_name set columnName (LOB)=value,colmun2 (String with 4000)=value where id=?;
实体类
- class Test{
- @Lob
- private String errorText;
- @Column(length = 4000)
- private String text;
- }
请帮帮我,这有什么不妥
谢谢
拉维库马尔
解决方法
运行oerr ora 24816以获取有关错误的详细信息:
- $oerr ora 24816
- 24816,... "Expanded non LONG bind data supplied after actual LONG or LOB column"
- // *Cause: A Bind value of length potentially > 4000 bytes follows binding for
- // LOB or LONG.
- // *Action: Re-order the binds so that the LONG bind or LOB binds are all
- // at the end of the bind list.
因此,仅使用1个查询的另一个解决方案是在所有非LOB / LONG绑定后移动您的LOB / LONG绑定. Hibernate可能会或可能不会这样.也许更像是:
- update T set column2 (String with 4000)=:1,columnName (LOB)=:3 where id=:2;
这个DML限制似乎至少来自Oracle 8i.
参考文献:
> http://openacs.org/forums/message-view?message_id=595742
> https://community.oracle.com/thread/417560