mybatis 批量更新(备忘)
来源:互联网 发布:linux 卸载openoffice 编辑:程序博客网 时间:2024/06/02 10:28
oracle和mysql数据库的批量update在mybatis中配置不太一样:
oracle数据库:
1
2
3
4
5
6
7
8
9
10
11
<
update
id=
"batchUpdate"
parameterType=
"java.util.List"
>
<foreach collection=
"list"
item=
"item"
index
=
"index"
open
=
"begin"
close
=
"end;"
separator=
";"
>
update
test
<
set
>
test=${item.test}+1
</
set
>
where
id = ${item.id}
</foreach>
</
update
>
mysql数据库:
mysql数据库采用一下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true
例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
1
2
3
4
5
6
7
8
9
10
11
<
update
id=
"batchUpdate"
parameterType=
"java.util.List"
>
<foreach collection=
"list"
item=
"item"
index
=
"index"
open
=
""
close
=
""
separator=
";"
>
update
test
<
set
>
test=${item.test}+1
</
set
>
where
id = ${item.id}
</foreach>
</
update
>
0 0
- mybatis 批量更新(备忘)
- mybatis 批量更新(batchUpdate)
- Mybatis 批量增加,批量更新
- Mybatis 批量插入、批量更新
- mybatis批量和更新(mysql)
- Mybatis中进行批量更新(updateBatch)
- Mybatis批处理(批量查询,更新,插入)
- Mybatis批量更新
- Mybatis批量更新
- Mybatis批量更新
- mybatis 批量更新
- mybatis 批量更新
- mybatis 批量更新
- Mybatis批量更新
- Mybatis批量更新
- Mybatis批量更新数据
- Mybatis批量更新
- mybatis批量更新
- Android L-preview PackageManagerService启动、安装和卸载分析
- oracle 截取字符串
- 嵌入式人才发展方向
- 自学编程的大牛是如何进入谷歌的
- CCCallFuncND 传参数
- mybatis 批量更新(备忘)
- 提升Tomcat服务器性能的七条经验
- hibernate 数据插入时覆盖以前的值
- Vision引擎中 环境地形编辑器介绍
- java 类加载机制
- 延长审限功能扩展
- Java基础
- redis作为hibernate的二级缓存
- java Date获取 年月日时分秒