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