ORA-24816:在实际LONG或LOB列之后提供的扩展非LONG绑定数据

109*_*733 8 java orm hibernate oracle11g

我在Hibernate中更新表时遇到异常

ORA-24816:在实际LONG或LOB列之后提供的扩展非LONG绑定数据

我也提取了sql查询,它看起来像

Update table_name set columnName (LOB)=value, colmun2 (String with 4000)=value where id=?;
Run Code Online (Sandbox Code Playgroud)

实体类

class Test{

    @Lob
    private String errorText;

    @Column(length = 4000)
    private String text;
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我,这有什么不妥

谢谢Ravi Kumar

mor*_*gil 6

运行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.
Run Code Online (Sandbox Code Playgroud)

因此,仅使用1个查询的另一个解决方案是在所有非LOB/LONG绑定后移动您的LOB/LONG绑定.Hibernate可能会或可能不会这样.也许更像是:

update T set column2 (String with 4000)=:1, columnName (LOB)=:3 where id=:2;
Run Code Online (Sandbox Code Playgroud)

这个DML限制似乎至少来自Oracle 8i.

参考文献:


109*_*733 3

我发现问题了。1.当hibernate更新数据库中的数据并且实体有4000个字符列和lob类型列时,hibernate抛出此异常

我通过编写两个更新查询解决了这个问题 1.首先我使用 Update() 保存了实体 2.为 lob 列更新编写了另一个更新查询

谢谢拉维