2

I able to save (spring-hibernate saveorupdate()) field

 @Lob
 @Column(name = "FILENAME")
 private String filename;

into oracle database datatype is clob

but when i try retrieve it, i get error

ERROR - JDBCExceptionReporter.logExceptions(72) | ORA-00932: inconsistent datatypes: expected - got CLOB

below is how i retrive from database

DetachedCriteria crit = DetachedCriteria.forClass(Storagefile.class);
crit.addOrder(bSortOrder ? Order.asc(sortColumnId) : Order.desc(sortColumnId));
 List<Storagefile> result = (List<Storagefile>) getHibernateTemplate().findByCriteria(crit, nFirst, nPageSize);

2 Answers 2

6

It's not clear from your sample code, but my guess is that you're trying to sort by the CLOB column, and Oracle does not permit that. That error code is Oracle's charming way of telling you this.

Are you sure you need to use a CLOB to store a filnename? Oracle can store up to 4000 characters in a VARCHAR2 column, surely that's enough for a filename? If you want to sort by the filename, then that's what you'll need to do.

Sign up to request clarification or add additional context in comments.

Comments

1

Have you waded through this:

https://www.hibernate.org/56.html

There seems to be an issue with the Oracle 9i driver and LOBs (not sure what your setup is).

1 Comment

i upgraded to 10gDialect but still the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.