I have a (hibernate generated) DB schema for an Oracle 11g XE database with a table having a CLOB column and VARCHAR (2000) column . and its associated audit table: {code} create table my_entity (id number(19,0) not null, details clob not null, title varchar2(2000 char) not null, primary key (id))
create table my_entity_aud (id number(19,0) not null, rev number(10,0) not null, revtype number(3,0), details clob, title varchar2(2000 char), primary key (id, rev)) {code}
Since HHH-4635, it is taken care that LOB columns will be last in insert and update statements because Oracle does not support if there is a variable binding parameter for a VARCHAR exceeding a certain size passed after the binding parameter for the CLOB column.
Accordingly, the generated insert statement for my_entity has {{details}} passed as last parameters: {{insert into my_entity (title, id, details) values (?, ?, ?)}}
However, for the envers statement, the VARCHAR column title comes after the CLOB column details: {{insert into my_entity_aud (revtype, details, title, id, rev) values (?, ?, ?, ?, ?)}}
which causes
{color:red}ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column{color}
{noformat} 2017-12-20 15:19:04.642 INFO 3476 --- [ main] c.g.h2m.service.MyEntityRepositoryTest : Started MyEntityRepositoryTest in 4.002 seconds (JVM running for 4.685) 2017-12-20 15:19:04.710 DEBUG 3476 --- [ main] org.hibernate.SQL : select hibernate_sequence.nextval from dual Hibernate: select hibernate_sequence.nextval from dual 2017-12-20 15:19:04.795 DEBUG 3476 --- [ main] org.hibernate.SQL : insert into my_entity (title, id, details) values (?, ?, ?) Hibernate: insert into my_entity (title, id, details) values (?, ?, ?) 2017-12-20 15:19:04.960 DEBUG 3476 --- [ main] org.hibernate.SQL : select hibernate_sequence.nextval from dual Hibernate: select hibernate_sequence.nextval from dual 2017-12-20 15:19:04.963 DEBUG 3476 --- [ main] org.hibernate.SQL : insert into user_rev_entity (timestamp, username, id) values (?, ?, ?) Hibernate: insert into user_rev_entity (timestamp, username, id) values (?, ?, ?) 2017-12-20 15:19:04.966 DEBUG 3476 --- [ main] org.hibernate.SQL : insert into my_entity_aud (revtype, details, title, id, rev) values (?, ?, ?, ?, ?) Hibernate: insert into my_entity_aud (revtype, details, title, id, rev) values (?, ?, ?, ?, ?) 2017-12-20 15:19:04.970 WARN 3476 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 24816, SQLState: 99999 2017-12-20 15:19:04.970 ERROR 3476 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column
{noformat}
I have a github repository where the error can be reproduced:https://github.com/h2m/hibernate-envers-HHH-12186 |
|