當(dāng)插入單字段超過4000字符的字符串到數(shù)據(jù)庫時遇到oracle 字段限制問題敞葛,通過對數(shù)據(jù)庫字段改為clob格式涕烧,ibatis里做相關(guān)配置沉衣,現(xiàn)在問題已解決盔然。
1.插入:變量參數(shù)必須用#,這樣配好javaType=java.lang.String,jdbcType=CLOB
<!-- 插入條件詳情信息 -->
<insert id="saveQueryInfoData" parameterClass="com.ways.app.query.entity.InsertEntity">
insert into dm_invoice_query_info (id,typeid,time,idstr,textstr,name,userid) values (
case when (select max(id) from dm_invoice_query_info) is null then 1 else (select max(id) from dm_invoice_query_info)+1 end
,#typeId#,sysdate,#idStr,javaType=java.lang.String,jdbcType=CLOB#,#textStr,javaType=java.lang.String,jdbcType=CLOB#,#name#,#userId#
)
</insert>
2.查詢:
通過ibatis里這樣的配置讨盒,數(shù)據(jù)庫插入時會自動轉(zhuǎn)成clob,查詢時自動轉(zhuǎn)成string