网上有很多关于mybatis批量更新的例子,但基本都是针对mysql或oracle的,针对db2的少之又少;
一、oracle+mybatis执行批量更新:
mapper.xml:
<update id="doupdateBatchResUpStatusById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
UPDATE EPJT_SBSJ_DBXX
<set>
RES_UP_STATUS=3,
res_local_err_desc=#{item.resLocalErrDesc},
res_local_err_code=#{item.resLocalErrCode},
RES_UP_TIME = #{item.resUpTime}
</set>
where RES_UP_STATUS=1 AND SBSJID = #{item.sbsjid}
</foreach>
</update>
dao接口:
public int doupdateBatchResUpStatusById(List<T> listObject)throws Exception;