ibatis 配置 oracle 存储过程

话就不多说。直接看代码吧;自己理解记录,不是很恰当。
欢迎拍砖!!!


<!-- 自定一个map容器,跟存储过程中输入变量一致 -->
<parameterMap class="hashmap" id="tableTempl">
<!-- 指定传入参数的java类型和jdbc类型 mode="IN" 表示输入;"OUT":输出参数-->
<parameter property="TEMP_TIME" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_ID" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_NAME" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_REMARK" jdbcType="VARCHAR"
javaType="string" mode="IN" />
</parameterMap>
<!-- 自定一个sqlmap-ID parameterMap指定为上面定义的map(重要)-->
<procedure id="SP_SysClientBaseTempTable" parameterMap="tableTempl">
<!-- <![CDATA[ 语句 ]]> 其中:<![CDATA[ ]]> 最好不要换行-->
<![CDATA[{call sp_client_base_template(?,?,?,?)}]]>
</procedure>
<parameterMap class="hashmap" id="tableColTempl">
<parameter property="TEMP_ITEM" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_ID" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_ITEM_NA" jdbcType="VARCHAR"
javaType="string" mode="IN" />
<parameter property="TEMP_TIME_DEC" jdbcType="VARCHAR"
javaType="string" mode="IN" />
</parameterMap>
<procedure id="SP_SysClientBaseTempTableCol" parameterMap="tableColTempl">
<![CDATA[{call sp_client_base_template_col(?,?,?,?)}]]>
</procedure>

配置完毕后,看java代码;
basedao为自定义dao操作接口;以spring注入了sqlMapClient(org.springframework.orm.ibatis.SqlMapClientFactoryBean)


//tabDataMap 对应 sqlmap配置中的 tableTempl
basedao.queryForObject("client_core_common.SP_SysClientBaseTempTable",
tabDataMap);
//tabColMap 对应 sqlmap配置中的 tableColTempl
HashMap tabColMap = (HashMap)tabColList.get(i);
basedao.queryForObject("client_core_common.SP_SysClientBaseTempTableCol",
tabColMap);



以上map集合中的tabDataMap 和 tabColMap
内容为:

tabDataMap = [{"TEMP_TIME":"2011-10-10 16:59:45","TEMP_NAME":"公文交 换","TEMP_REMARK":"123123","TEMP_ID":"201191165945703"}]


tabColMap = [{"TEMP_TIME_DEC":"正文","TEMP_ITEM_NA":"正文","TEMP_ID":"201191165945703","TEMP_ITEM":"DOC_TEXT"},{"TEMP_TIME_DEC":"附件字段15","TEMP_ITEM_NA":"附件字段15","TEMP_ID":"201191165945703","TEMP_ITEM":"ADDITIONAL10"},{"TEMP_TIME_DEC":"附件字段9","TEMP_ITEM_NA":"附件字段9"}]


结束!按照以上配置保你ibatis配置存储过程没有问题。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值