Take the 2-minute tour ×

I've run into the following issue, which seems to be a pretty common one. The exception is Cannot update entity: [...] nested exception is java.sql.BatchUpdateException: ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column. It looks like Oracle does not like binding large values (> 4000 chars) to parameters after a LOB or CLOB. Has anyone solved this issue?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

This is: ORA-24816
*It's a limitation, and that LONG bind variables must come last in a statement. *

source: http://www.odi.ch/weblog/posting.php?posting=496

Solution: By renaming the fields in the hibernate model so that the clob column has a name that comes later than the varchar2 column when ordering alphabetically (I prefixed the clob field in the java class with a 'z'), everything works fine because then the clob parameter comes after the varchar parameter in the query hibernate builds.

share|improve this answer
I found that with XML-mapped entities I could change the order of the properties in the config to get the clobs to the end of the INSERT/UPDATE statement. E.g. <property name="shortField1"/><property name="shortField2"/><property name="reallyLongField" type="text"/> –  Josh Johnson Sep 12 '12 at 12:40
add comment

Your Answer


