zoukankan      html  css  js  c++  java
  • Mybatis在oracle批量更新

    最近公司业务中为了提高效率要做mybatis批量更新,但是到了oracle数据库中做了好几次都没成功,后来发现mybatis最后少了个分号,可能是Mybatis内部做了异常try  catche  处理,导致控制台没有报错信息。在此仅做小记。

    Mapper文件中的方法定义如下:

    public int updateCreditStatuslist(List<UserCreditStatus> list);

    Mapper.xml文件的实现如下:(creditStatus是对象内部的成员,id是对象内部的一个对象)

    <update id="updateCreditStatuslist" parameterType="java.util.List">


    <foreach collection="list" item="item" index="index" separator=";">
      update XB_CREDIT_STATUS_P
      set
      CREDIT_STATUS=#{item.creditStatus}, CREDIT_TIME=#{item.creditTime}


      where subsid=#{item.id.subsId} and OPERATIONID=#{item.id.operationId}
      and
      SUB_OPERATIONID=#{item.id.subOperation}
    </foreach>
      ;  <!--注意红色的分号,不加就不会批量更新,并且不会报错。。。。-->

    </update>

    原创博文,未经许可不得转载,转载请注明出处。
  • 相关阅读:
    Android Zygote介绍
    Android binder介绍(下)
    Android binder介绍(上)
    Android init介绍(下)
    Android init介绍(上)
    Android 网络服务介绍
    Linux代理服务器使用
    Linux ALSA介绍
    ZigBee MAC层(下)
    ZigBee MAC层(上)
  • 原文地址:https://www.cnblogs.com/Think-007/p/7016737.html
Copyright © 2011-2022 走看看