ibatis + spring框架下,对CLOB字段操作。
TfBTradeInterSend.xml设置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="TfBTradeInterSend">
<typeAlias alias="TfBTradeInterSend" type="com.sitech.groupcust.common.dto.TfBTradeInterSend"/>
<resultMap id="TfBTradeInterSendResult" class="TfBTradeInterSend">
<result property="tradeId" column="TRADE_ID"/>
<result property="subscribeId" column="SUBSCRIBE_ID"/>
<result property="infaceType" column="INFACE_TYPE"/>
<result property="dealState" column="DEAL_STATE"/>
<result property="dealMsg" column="DEAL_MSG"/>
<result property="resendCount" column="RESEND_COUNT"/>
<result property="sendContent" column="SEND_CONTENT" javaType="java.lang.String" jdbcType="CLOB"/>
<result property="dealDate" column="DEAL_DATE"/>
<result property="inDate" column="IN_DATE"/>
<result property="notes" column="NOTES"/>
<result property="provinceCode" column="PROVINCE_CODE"/>
</resultMap>
t.send_content: 类型是CLOB。
问题描述:根据上面sqlMapClient设置后,当对send_content进行插入、更新操作时,没问题。但是当以send_content:作为查询条件时,报下面的错误:
ORA-00932: inconsistent datatypes
解决:
select * from tf_b_trade_inter_send t where
dbms_lob.instr(t.send_content,'02BBSS000100001348479247031914',1,1)>0
参考:http://www.iteye.com/problems/64807