mybatis怎么读取oracle xmltype类型的数据
推荐于2016-07-24
展开全部
表结构
CREATE TABLE USERINFO(USERID www.hbbz08.com VARCHAR2(5),
USERNAME VARCHAR2(20),
MEMO CLOB,
constraint PK_USERINFO primary key(USERID));
java代码:
public class OracleClobTypeHandlerCallback implements TypeHandlerCallback {
public void setParameter(ParameterSetter setter, Object obj)
throws SQLException {
CLOB clob = CLOB.empty_lob();
clob.setString(1, (String)obj);
setter.setClob(clob);
}
public Object getResult(ResultGetter getter) throws SQLException {
CLOB clob = (CLOB) getter.getClob();
return (clob == null || clob.length() == 0 )? null :clob.getSubString((long)1, (int)clob.length());
}
public Object valueOf(String param) {
return null;
}
}
CREATE TABLE USERINFO(USERID www.hbbz08.com VARCHAR2(5),
USERNAME VARCHAR2(20),
MEMO CLOB,
constraint PK_USERINFO primary key(USERID));
java代码:
public class OracleClobTypeHandlerCallback implements TypeHandlerCallback {
public void setParameter(ParameterSetter setter, Object obj)
throws SQLException {
CLOB clob = CLOB.empty_lob();
clob.setString(1, (String)obj);
setter.setClob(clob);
}
public Object getResult(ResultGetter getter) throws SQLException {
CLOB clob = (CLOB) getter.getClob();
return (clob == null || clob.length() == 0 )? null :clob.getSubString((long)1, (int)clob.length());
}
public Object valueOf(String param) {
return null;
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询