需要把clob字段转换成String类型的,方法如下:
List<Map> bySqlWithMap = this.findBySqlWithMap(sql.toString(), paramList.toArray()); for(Map<String, Object> data:bySqlWithMap){ for(String key:data.keySet()){ if(data.get(key) instanceof Clob){ Clob clob = (Clob) data.get(key); try { data.put(key, clob.getSubString((long)1,(int)clob.length())); } catch (SQLException e) { e.printStackTrace(); } } } }
或在上一步中调用下列方法:
public String ClobtoString(Clob clob){ String reString = ""; Reader is = null; try { is = clob.getCharacterStream(); } catch (Exception e) { e.printStackTrace(); } // 得到流 BufferedReader br = new BufferedReader(is); String s = null; try { s = br.readLine(); } catch (Exception e) { e.printStackTrac