java clob oracle,java程序处理oracle的clob对象

2019独角兽企业重金招聘Python工程师标准>>>

6936d1565ae689371725cdb5fc51c415.png

ibatis 主配置文件SqlMapConfig.xml

ArticleColumnDymanic配置文件:

PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-2.dtd">

select seq_article.nextVal from dual

insert into tb_article_columndymanic( i_id,vc_name,vc_url,vc_filePath,vc_file,b_content,vc_desc,i_num,d_createtime,i_createuser,d_lastmodtime,i_moduser,c_deleted,vc_version,vc_isnew,vc_id,vc_remark)

values (#id#,#name#,#servletUrl#,#filePath#,#file#,#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#,#desc#,#num#,sysdate,#base.createUser#,sysdate,#base.modUser#,'0',#version#,#isnew#,

#id#

#vid# ,#remark#)

update tb_article_columndymanic

set vc_name=#name#,vc_url=#servletUrl#,vc_filePath=#filePath#,vc_file=#file#,

b_content=#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#,vc_desc=#desc#,i_num=#num#,

d_lastmodtime=sysdate,i_moduser=#base.modUser#,

vc_version=#version#,vc_isnew=#isnew#,vc_id=#vid#,vc_remark=#remark#

where i_id=#id#

实体类:

public class ArticleColumnDymanic {

private String name="";

private String servletUrl="";

private String filePath="";

private String file="";

private String content="";

private String desc="";

private int num=0;

private Long version=new Long(1);

private String isnew="1";

private Long vid;

private String remark;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getServletUrl() {

return servletUrl;

}

public void setServletUrl(String servletUrl) {

this.servletUrl = servletUrl;

}

public String getFilePath() {

return filePath;

}

public void setFilePath(String filePath) {

this.filePath = filePath;

}

public String getFile() {

return file;

}

public void setFile(String file) {

this.file = file;

}

public String getContent() {

return content;

}

public void setContent(String content) {

this.content = content;

}

public String getDesc() {

return desc;

}

public void setDesc(String desc) {

this.desc = desc;

}

public int getNum() {

return num;

}

public void setNum(int num) {

this.num = num;

}

public Long getVersion() {

return version;

}

public void setVersion(Long version) {

this.version = version;

}

public String getIsnew() {

return isnew;

}

public void setIsnew(String isnew) {

this.isnew = isnew;

}

public Long getVid() {

return vid;

}

public void setVid(Long vid) {

this.vid = vid;

}

public String getRemark() {

return remark;

}

public void setRemark(String remark) {

this.remark = remark;

}

}

查询clob字段:

select b_content

from tb_article_info a,

tb_article_fund b, tb_article_content c

where a.i_articleid =

b.i_articleid

and a.i_articleid = c.i_articleid

and i_columnid = '5908'

and c.c_deleted='0'

and a.c_deleted='0'

and b.c_deleted='0'

vc_fundcode = #fundCode#

public List> selectProductById(HashMapmap)

{

List listm = this.dao.findForList("selectProductById", map);

if ((listm != null) && (listm.size() > 0)) {

for (int i = 0; i < listm.size(); ++i) {

HashMap hm = (HashMap)listm.get(i);

CLOB clob = (CLOB)hm.get("B_CONTENT");

try {

hm.put("B_CONTENT", ClobToString(clob));

}

catch (Exception e) {

e.printStackTrace();

}

}

}

return listm;

}

private static String ClobToString(CLOB clob) throws Exception {

String reString = "";

Reader is = clob.getCharacterStream();

BufferedReader br = new BufferedReader(is);

String s = br.readLine();

StringBuffer sb = new StringBuffer();

while (s != null) {

sb.append(s);

s = br.readLine();

}

reString = sb.toString();

return reString;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值