When doing an update I get a SQL exception, stacktrace below. For handling the Oracle CLOB I use the StringClobType found on this site. This works fine in other parts of my application.
When I do the update that fails, I have the class called Study containing a collection of StudyUpdate objecs. The StudyUpdate contains the foreign key, a date field and a large text - the CLOB field. For generating the error, I do first an insert with one StudyUpdate in my Study. This works fine, adding a new StudyUpdate OR removing the StudyUpdate and then updating also works fine. But if I clear the collection AND add a new StudyUpdate, I get the exception when executing the update.
All these test cases works if I replace the CLOB with a String/Varchar2 field. And, as I said, I have the CLOB working in other tables but not in a composite. A workaround is to change the Composite into a ordinary one-to-many but I would like to solve the problem.
My best guess is that when Hibernate tries to remove objects in the collection, it uses the clob as a parameter in the where-statement but not using the preparedStatement.setClob(), but I am not sure.
Hibernate version: 2.1.6
Name and version of the database you are using: Oracle 9
The generated SQL (show_sql=true):
delete from STUDY_UPDATE where FK_STUDY=? and TEXT=? and CHANGED_DATE=?
Full stack trace of any exception that occurs:
08:45:33,558 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected - got CLOB
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4133)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:126)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:59)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:109)
at net.sf.hibernate.collection.AbstractCollectionPersister.insertRows(AbstractCollectionPersister.java:605)
at net.sf.hibernate.impl.ScheduledCollectionUpdate.execute(ScheduledCollectionUpdate.java:49)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2374)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)
|