具体报错信息:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_ecoYksKpi_0' not found. Available parameters are [list, param1]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:76)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
at com.sun.proxy.$Proxy22.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:269)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:54)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy33.updateBatch(Unknown Source)
at com.yks.eco.service.impl.EcoYksKpiServiceImpl.updateBatch(EcoYksKpiServiceImpl.java:94)
at Test.initKpiData(Test.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.binding.BindingException: Parameter '__frch_ecoYksKpi_0' not found. Available parameters are [list, param1]
at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:165)
at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:44)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:116)
at org.apache.ibatis.reflection.MetaObject.metaObjectForProperty(MetaObject.java:138)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:109)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:76)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
at com.sun.proxy.$Proxy44.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
... 35 more

java文件接口:

/**
* 批量更新数据
*
* @param list 实例对象集合
* @return 更新成功数量
*/
int updateBatch(@Param("list") List<EcoYksKpi> list); mappper.xml文件:
<!--批量更新-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" separator=";" index="index" item="ecoYksKpi">
update eco_yks_kpi set
modifier = #{ecoYksKpi.modifie}
where id = #{ecoYksKpi.id}
</foreach>
</update> 实体类:
对应字段:
protected String modifier;//修改人

可以看到我的字段写错了,少了个‘r’。
正确的mapper.xml文件写法:
<!--批量更新-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" separator=";" index="index" item="ecoYksKpi">
update eco_yks_kpi set
modifier = #{ecoYksKpi.modifier}
where id = #{ecoYksKpi.id}
</foreach>
</update>
另外,还有可能是实体类的get、set方法不是规范,不是get/set+按照首字母大写的方式
第三,可能是xml,文件中添加了jdbcType字段,但是=两边有空格
#{ecoYksKpi.modifier,jdbcType= VARCHAR}
去掉空格即可,如下
#{ecoYksKpi.modifier,jdbcType=VARCHAR}
												

mybatis批量更新报错 org.mybatis.spring.MyBatisSystemException的更多相关文章

  1. druid + mysql + mybatis 批量更新报错

    首先 批量更新报错 sql injection violation, multi-statement not allow 然后看了博客:https://blog.csdn.net/qq_3634595 ...

  2. mybatis批量更新报错badsql

    mybatis批量更新时语法写的都对,但是报错,需要在连接上面加上allowMultiQueries=true 示例:jdbc:MySQL://192.168.1.236:3306/test?useU ...

  3. mybatis批量更新报错

    批量更新sql <update id="updateAutoAppraiseInfo" parameterType="Object"> <fo ...

  4. Mybatis批量更新报错com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

    批量更新数据,非常简单的一段代码,硬是报错,插入的数据也能显示出来 List<User> userlist = new ArrayList<User>(); userlist. ...

  5. mybatis批量插入报错

    报错内容 org.springframework.jdbc.UncategorizedSQLException: ### Error updating database. Cause: java.sq ...

  6. 解决Oracle+Mybatis批量插入报错:SQL 命令未正确结束

    Mybatis批量插入需要foreach元素.foreach元素有以下主要属性: (1)item:集合中每一个元素进行迭代时的别名. (2)index:指定一个名字,用于表示在迭代过程中,每次迭代到的 ...

  7. Mybatis批量insert报错的解决办法【the right syntax to use near '' at line...】

    Java中使用Mybatis批量插入数据时Mapper.xml中的sql如下: <insert id="batchSave"> into t_emp(emp_name, ...

  8. mybatis批量新增报错 BadSqlGrammarException

    org.springframework.jdbc.BadSqlGrammarException: ### Error updating database. Cause: com.mysql.jdbc. ...

  9. mybatis批量更新update-设置多个字段值 报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

    mybatis批量更新update-设置多个字段值 2016年08月01日 12:49:26 姚一号 阅读数:29539 标签: mysql mybatis批量更新批量更新allowMultiQuer ...

随机推荐

  1. Corrupt JPEG data: 1 extraneous bytes before marker 0xd9 JPEG datastream contains no image

    Corrupt JPEG data: 1 extraneous bytes before marker 0xd9 JPEG datastream contains no image 对比发送时的全部数 ...

  2. google cloud storage products

    https://cloud.google.com/products/storage/ BigTable Cloud Bigtable 是 Google 面向大数据领域的 NoSQL 数据库服务.它也是 ...

  3. MySQL 使用 ON UPDATE CURRENT_TIMESTAMP 自动更新 timestamp (转)

    原文地址: https://blog.csdn.net/heatdeath/article/details/79833492 `create_time` timestamp not null defa ...

  4. EasyNVR摄像机网页无插件直播方案H5前端构建之:区分页面是自跳转页面还是分享页面

    背景分析 EasyNVR整套方案的架构中,涉及到前端设备(摄像机IPC.硬盘录像机NVR.编码器等).流媒体服务端(EasyNVR).客户端终端设备(PC.浏览器.Android.iOS.微信). 在 ...

  5. qtableview 右键菜单弹出及获取数据

    connect(tableView, SIGNAL(customContextMenuRequested(const QPoint &)), this,SLOT(slot_tableViewM ...

  6. 搭建ELK日志分析平台

    (上)—— ELK介绍及搭建 Elasticsearch 分布式集群 http://blog.51cto.com/zero01/2079879 (下)—— 搭建kibana和logstash服务器 h ...

  7. TELNET可以连通但无法创建数据库连接(Oracle)

    问题描述: 近期客户方进行了网络调整,申请A服务器的1521端口开通后,telnet可以访问,但是SQLPLUS.PLSQL等工具一直无法创建相应连接,提示连接超时. 问题排查: 对开放端口的所有服务 ...

  8. python的mysql数据库操作

    python操作mysql数据库 Python 标准数据库接口为 Python DB-API,Python DB-API为开发人员提供了数据库应用编程接口. Python 数据库接口支持非常多的数据库 ...

  9. Fineui alert去掉关闭按钮,去掉X

    参考:http://fineui.com/bbs/forum.php?mod=viewthread&tid=7455&highlight=alert           http:// ...

  10. 【PYQT5快速开发】重定义边框、QSS美化皮肤主题

    在用qt designer的基础上重定义边框 前言 作为一名技术工作者,偶有使用.开发工具的需求.制作工具时,既不想在界面上花太懂功夫,又想要工具模样与众不同,结果找半天找不到一键换装的功能/拍砖. ...