These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error using Clob in composite?
PostPosted: Mon Oct 18, 2004 3:37 am 
Newbie

Joined: Mon Oct 18, 2004 3:08 am
Posts: 2
Location: Sweden
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)


Top
 Profile  
 
 Post subject: Sound familiar?
PostPosted: Wed Oct 20, 2004 3:11 am 
Newbie

Joined: Mon Oct 18, 2004 3:08 am
Posts: 2
Location: Sweden
Have you had a problem like this? Did you solve it or just dropped the composite pattern?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.