首页 > 其他 > 详细

mybatis批量更新表setting parameters 错误

时间:2019-09-18 21:00:13      阅读:128      评论:0      收藏:0      [点我收藏+]

mybatis中想用 foreach标签 批量update set表
下面是mapper.xml

<update id="updateMonitorById" parameterType="java.util.List">
        <foreach collection="list" item="bean" index="index" open="" close="" separator=";">
            UPDATE dt_monitor
            <set>
                account_name = #{bean.companyAccount},
                sip_name = #{bean.sipName}
            </set>
            <where>
                company_id = #{bean.companyId}
            </where>
            ORDER BY update_time desc limit 1
        </foreach>
    </update>

传入的List数量大于1的时候就报错。
后来发现是数据库配置的原因
在配置数据库连接地址中加上
&allowMultiQueries=true

jdbcDriver=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql:///cake?characterEncoding=utf-8&allowMultiQueries=true
jdbcusername=root
jdbcpassword=1

mybatis批量更新表setting parameters 错误

原文:https://www.cnblogs.com/magicya/p/11545024.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!