Oracle JSON clob__html

Source: Internet
Author: User

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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.