开发者

cannot get clob datatype from database into JPA entity

开发者 https://www.devze.com 2022-12-15 04:10 出处:网络
I able to save (spring-hibernate saveorupdate()) field @Lob @Column(name = \"FILENA开发者_C百科ME\")

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

 @Lob
 @Column(name = "FILENA开发者_C百科ME")
 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消