欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mybatis执行批量更新batch update 的方法(oracle,mysql)_MySQL

程序员文章站 2022-05-22 17:57:09
...
oracle和mysql数据库的批量update在mybatis中配置不太一样:

oracle数据库:

				update test 								  test=${item.test}+1								where id = ${item.id}	   

mysql数据库:

mysql数据库采用一下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true

例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true

				update test 								  test=${item.test}+1								where id = ${item.id}