数据表
create table test( TASKID NUMBER(10) not null, CONFIG CLOB)
controller
@ResponseBody @RequestMapping("/getTest") public List getTest(HttpServletRequest request, HttpServletResponse response){ return this.Service.getTest(); }
sql.xml
1、没有做任何处理情况,程序报错如下
Caused by:org.codehaus.jackson.map.JsonMappingException: No serializer found for classoracle.sql.LobDBAccessImpl and no properties discovered to createBeanSerializer (to avoid exception, disableSerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain:java.util.ArrayList[0]->java.util.HashMap["CONFIG"]->oracle.sql.CLOB["dbaccess"])
2、在sql.xml中,对CLOB字段Config进行to_char()处理,开始能够解决问题,后面出现数据库报错的情况
sql.xml
数据库报错
3、去掉@ResponseBody,将返回的结果打印出来,发现config是一个对象
controller
//@ResponseBody @RequestMapping("/getTest") public List getTest(HttpServletRequest request, HttpServletResponse response){ System.out.println(this.Service.getTest()); return this.Service.getTest(); }
debug
[{CONFIG=oracle.sql.CLOB@16e2b70,TASKID=38}]
4、在Mybatis中采用resultMap处理,程序正常,debug时config为具体内容。
sql.xml