In the project development, the MySQL developed system into Oracle development, there are CLOB transformation errors
The exception thrown
[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] - resolving exception from handler [public com.waysoft.common.responsedata Com.waysoft.modules.common.query.controller.CommonController.getPageList (javax.servlet.http.HttpServletRequest , Javax.servlet.http.HttpServletResponse)]: Org.springframework.http.converter.httpmessagenotwritableexception: could not write json: no serializer found for class oracle.jdbc.driver.oracleclobreader and no properties discovered to create BeanSerializer (to avoid Exception, disable serializationfeature.fail_on_empty_beans ) (through reference chain: com.waysoft.common.responsedata["Data"]->com.waysoft.common.mybitis.page.page["list"]- >java.util.arraylist[0]->java.util.hashmap["Operate_url_params_"]->com.alibaba.druid.proxy.jdbc.clobproxyimpl["Characterstream"]); nested exception is Com.fasterxml.jackson.databind.jsonmappingexception: no serializer found for class oracle.jdbc.driver.oracleclobreader and no properties discovered to create BeanSerializer (to avoid exception, disable serializationfeature.fail_on_empty_ BEANS ) (through reference chain: com.waysoft.common.responsedata["Data"]-> com.waysoft.common.mybitis.page.page["List"]->java.util.arraylist[0]->java.util.hashmap["Operate_url_ Params_ "]->com.alibaba.druid.proxy.jdbc.clobproxyimpl[" Characterstream "])
Solution
Public Page getpagelist (String sqlid,page page,map<string,object> Map) throws SQLException {
Map.put ("page", page);
List<map<string,object>> list=getsqlsession (). SelectList (Sqlid, MAP);
for (map<string,object> data:list) {
For (String Key:data.keySet ()) {
if (Data.get (key) instanceof Clob) {
Clob Clob = (Clob) data.get (key);
Data.put (Key, Clob.getsubstring ((Long) 1, (int) clob.length ()));
}
}
}
Page.setlist (list);
return page;
}