Hibernate和CLOB的奇怪的Oracle错误

Abd*_*aly 5 hibernate oracle10g

我遇到了以下问题,这似乎是一个非常 常见的问题.例外是Cannot update entity: [...] nested exception is java.sql.BatchUpdateException: ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column.看起来Oracle不喜欢在LOB或CLOB之后将大值(> 4000个字符)绑定到参数.有人解决了这个问题吗?

Mac*_*eft 9

这是:ORA-24816
**这是一个限制,LONG绑定变量必须在语句中排在最后.**

来源:http://www.odi.ch/weblog/posting.php?postting = 496

解决方案:通过重命名hibernate模型中的字段,以便clob列在按字母顺序排序时具有晚于varchar2列的名称(我在java类中使用'z'作为前缀字段前缀),一切正常,因为那时候clob参数位于查询hibernate构建中的varchar参数之后.