views:

288

answers:

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);
+1  A: 

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).

davek
i upgraded to 10gDialect but still the same.
cometta
+3  A: 

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.

skaffman
u're right. it's sorting that caused it
cometta