springboot mybaits 批量更新报错:updateBatch-Inline
来源:互联网 发布:linux 下安装jdk 编辑:程序博客网 时间:2024/06/01 14:37
小编使用springboot,mybatis做批量更新的时候控制台报错updateBatch-Inline
原因:
配置的 mysql jdbc 链接字符串 默认不支持一次性执行多个sql 语句。需要在配置数据库连接的url后面加上
characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true
附:spring springmvc mybatis 整合批量操作,批量更新,批量插入
1、批量插入
<insert id="insertBatch" parameterType="java.util.List"> insert into sc_course_schedule (schoolid,teacherid,courseid,semesterid,classroomid,coursedesc,sequenceno,course_week,course_weekly,starttime,endtime,state,createtime,creator,modifytime,operater) values <foreach collection="list" item="item" index="index" separator=",">(#{item.schoolid},#{item.teacherid},#{item.courseid},#{item.semesterid},#{item.classroomid},#{item.coursedesc},#{item.sequenceno},#{item.course_week},#{item.course_weekly},#{item.starttime},#{item.endtime},#{item.state},#{item.createtime},#{item.creator},#{item.modifytime},#{item.operater}) </foreach> </insert>
2、批量更新
<update id="updateBatch" parameterType="java.util.List"> <foreach collection="list" item="item" index="index" open="" close="" separator=";"> update sc_course_schedule <set> teacherid=#{item.teacherid}, courseid=#{item.courseid}, classroomid=#{item.classroomid}, coursedesc=#{item.coursedesc}, modifytime=#{item.modifytime}, operater=#{item.operater} </set> <where> id=#{item.id} </where> </foreach> </update>
3、批量删除
<delete id="deleteBatch" parameterType="java.util.List"> delete from sc_course_schedule where id IN <foreach collection="list" item="item" open="(" separator="," close=")"> #{item.id} </foreach> </delete>
阅读全文
0 0
- springboot mybaits 批量更新报错:updateBatch-Inline
- Mybatis中进行批量更新(updateBatch)
- mybaits如何批量更新数据库
- 使用 updatebatch 批更新
- mybatis批量更新报错问题解决
- mybaits 更新choose标签条件Y加了单引号报错
- mysql mybaits批量更新时遇到的一个小问题
- springboot mybaits mysql 整合
- mybaits批量操作数据库
- mybaits批量插入
- Mybaits 批量操作
- Mybaits的批量插入
- mybaits批量插入
- mybaits+oracle批量操作
- mybaits中的批量操作
- mybaits批量新增修改
- 使用MyBatis进行批量的更新、删除报错
- 启动springboot报错
- 数据插值
- c++11实现写优先的读写锁
- 判断文件格式和大小的js代码
- phpstudy 切换服务器和php版本
- SpringBoot 中文手册 --Part IV --36 用JTA进行分布式事务
- springboot mybaits 批量更新报错:updateBatch-Inline
- mybatis使用接口
- js方法
- java在SSM下使用支付宝扫码支付
- MyBatis日志
- (springmvc)页面找不到静态资源文件Failed to load resource: the server responded with a status of 404 (Not Found)
- mt6735 [Audio App]拖动歌曲计时条过程中,如何显示当前快进的时间
- TraceView 创建文件.trace文件出现 read-only file system问题
- Java NIO Channel