java mysql mybatis批量更新怎么弄?

<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update course
<set>
name=${item.name}
</set>
where id = ${item.id}
</foreach>
</update>

网上这样的例子对吗

Java mysql mybatis批量更新数据库,采用以下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true

例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&amp;characterEncoding=UTF-8&allowMultiQueries=true
<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>

MyBatis是支持普通SQL查询,存储过程和高级映射的优秀持久层框架。MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索。MyBatis使用简单的XML或注解用于配置和原始映射,将接口和Java的POJOs(Plan Old Java Objects,普通的Java对象)映射成数据库中的记录.

温馨提示:答案为网友推荐,仅供参考