mybatis执行批量更新batch update 的方法(oracle,mysql)
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                mybatis执行批量更新batch update 的方法(oracle,mysql)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                oracle和mysql數(shù)據(jù)庫(kù)的批量update在mybatis中配置不太一樣:
?
?
?
oracle數(shù)據(jù)庫(kù):
?
?
?
?
<updateid="batchUpdate" parameterType="java.util.List"><foreach collection="list"item="item"index="index"open="begin"close="end;"separator=";">updatetest<set>test=${item.test}+1</set>whereid = ${item.id}</foreach></update>?
mysql數(shù)據(jù)庫(kù):
?
mysql數(shù)據(jù)庫(kù)采用一下寫法即可執(zhí)行,但是數(shù)據(jù)庫(kù)連接必須配置:&allowMultiQueries=true
?
?
?
例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true?
<updateid="batchUpdate" parameterType="java.util.List"><foreach collection="list"item="item"index="index"open=""close=""separator=";">updatetest<set>test=${item.test}+1</set>whereid = ${item.id}</foreach></update>?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的mybatis执行批量更新batch update 的方法(oracle,mysql)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Android之ActionBar常用设
- 下一篇: Android之RxJava(一)
