首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

ibatis中 oracle的 clob 部类转换为string

2013-11-08 
ibatis中 oracle的 clob 类型转换为string1.在resultmap中加入result propertycontent columnPRN_TP

ibatis中 oracle的 clob 类型转换为string
1.在resultmap中加入
<result property="content" column="PRN_TPL_CONTENT" typeHandler="org.springframework.orm.ibatis.support.ClobStringTypeHandler" />

2.使用方法转换

public String ClobToString(CLOB clob) throws SQLException, IOException {String reString = "";Reader is = clob.getCharacterStream();// 得到流BufferedReader br = new BufferedReader(is);String s = br.readLine();StringBuffer sb = new StringBuffer();while (s != null) {// 执行循环将字符串全部取出付值给////StringBuffer由StringBuffer转成stringsb.append(s);s = br.readLine();}reString = sb.toString();return reString;}

热点排行