Question

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);
Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top