当在mybatis用到foreach的时候,会报这个错误Parameter '__frch_item_0' not found. Available parameters are [list]会出现的几种解决方案

例子

  1. <insert id="insertBatchPicAttachment"  parameterType="java.util.List">
  2. insert into pic_attachment
  3. (pic_id,pic_udid,relate_id,relate_code,relate_code_dtl,pic_name,pic_url,pic_remote_url)
  4. values
  5. <foreach collection="list"  item="item" index="index" separator=",">
  6. (#{item.picId},#{item.picUdid},#{item.relateId},#{item.relateCode},#{item.relateCodeDtl},#{item.picName},#{item.picUrl},#{item.picRemoteUrl})
  7. </foreach>
  8. <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="picId">
  9. select LAST_INSERT_ID();
  10. </selectKey>
  11. </insert>

1.查看parameterType的类型是不是Java.util.List类型,如果是的话,看foreach 的collection属性是不是list,

因为 传递一个 List 实例或者数组作为参数对象传给 MyBatis,MyBatis 会自动将它包装在一个 Map 中,用名称在作为键。List 实例将会以“list” 作为键,而数组实例将会以“array”作为键

2.看一下foreach里面的值有没有传递进来

3.看foreach里面的名称字段是否写错

4.还有就是我用Mybatis的时候,用MySQL的值插入自动增长值,里面的key我在数据库中没有设置自动增长,然后我又用了selectkey,所以也会出现这种情况

--------------------------------------------------------------------

还有一种情况是item的属性不对,我在使用通用Map的时候,发现此问题。

通用Map的好处是减少了对Bean的书写,问题是如果数据库的查询结果为Null,对应属性的key也就不存在。

mybatis 批量增加 Parameter '__frch_item_0' not found. Available parameters are [list]的更多相关文章

  1. mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]

    一次在做批量更新数据的时候报错 Parameter '__frch_item_0' not found. Available parameters are [list] 记过反复查找,最后才发现是一个 ...

  2. 解决使用mybatis做批量操作时发生的异常:Parameter '__frch_item_0' not found. Available parameters are [list] 记录

    本文主要描述 使用mybatis进行批量更新.批量插入 过程中遇到的异常及总结: 首先贴出使用批量操作报的异常信息: java.lang.RuntimeException: org.mybatis.s ...

  3. 解决mybatis foreach 错误: Parameter '__frch_item_0' not found

    解决mybatis foreach 错误: Parameter '__frch_item_0' not found 在遍历对象的属性(是ArrayList对象)时报错: org.mybatis.spr ...

  4. 解决Parameter '__frch_item_0' not found. Available parameters 问题

    1. 问题描述: 出现如下问题,执行报错信息 Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org ...

  5. mybatis批量增加与删除——(十五)

    1.首先应该明白,mybatis增删改返回值是int型的影响行数的值 mapper接口 package cn.xm.mapper; import java.util.List; import cn.x ...

  6. spring 整合Mybatis 错误:Parameter 'items_id' not found. Available parameters are [array]

    运行环境:jdk1.7.0_17+tomcat 7 + spring:3.2.0 +mybatis:3.2.7+ eclipse 错误:Parameter 'items_id' not found. ...

  7. IDEA下运行 mybatis报错 Parameter 'arg0' not found. Available parameters are [autoRecharge, id, param1, param2]

    电脑换系统之后重新安装一了 一下idea 项目运行时出现了以下错误, [autoRecharge, id, param1, param2] 或 [arg0, id, arg1, param2] 参考地 ...

  8. Mybatis传多个参数的问题 及MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1 问题

    对于使用Mybatis ,传多个参数,我们可以使用对象封装外,还可以直接传递参数 对象的封装,例如查询对象条件basequery对象 <select id="getProductByP ...

  9. Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]

    GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegra ...

随机推荐

  1. sql 的REPLACE

    REPLACE 用第三个表达式替换第一个字符串表达式中出现的所有第二个给定字符串表达式. 语法 REPLACE ( 'string_expression1' , 'string_expression2 ...

  2. .net 任务(Task)

    1. Task (任务): 很容易调用 ThreadPool.QueueUserWorkItem 实现异步操作,但是这个技术有许多 .net 引入Task类型来使用任务. 如下几种方式都是实现异步的方 ...

  3. Arduino I2C + 气压传感器LPS25H

    LPS25H是ST生产的MEMS数字气压传感器.主要特性有: 测量范围:260 ~ 1260 hPa绝对气压 分辨率:均方根1 Pa 工作电压:1.7 ~ 3.6 V 功耗:4μA(低分辨率模式)~2 ...

  4. How to use the NFS Client c# Library

    类库下载 I add a wiki page that explains how to use the NFS Client c# .net library in your project. Neko ...

  5. 用Visual Studio 2015 编译张帆的第一个NT式驱动,并且成功安装到Windows XP里面!!!

    开发工具:Visual Studio 2015 企业版 目 标 机:Windows XP X86 前提:我们已经成功安装了Visual Studio 2015以及WDK,而且更重要一点是一定要SDK版 ...

  6. 非固定参数:*args和 **kwargs

    先看一个固定参数栗子: def func1(x, args): print(x, args) func1(1,22) ====================1 22 ================ ...

  7. mysqldump导出数据不带时区信息的问题

    今天在导出数据时,发现所有timestamp字段都不带时区信息,因为我在东8区,导出的数据中所有时间都提早了8个小时 首先先看表的字段和数据 CREATE TABLE IF NOT EXISTS `a ...

  8. docker部署sftp

    一. 按照我博客中搭建sftp的方法做一个docker镜像 这种方法可用,但不是最好的,待改进.可参照另一篇博客:设置多用户不同权限的sftp服务器搭建 1. dockerfile文件如下,当前目录假 ...

  9. linux设置ip别名

    修改文件 # vi /etc/hosts 添加地址和别名 192.168.222.126 s1 ##前面是机器ip,后面是别名 测试 [root@bogon /]# ping s1 PING s1 ( ...

  10. ajax方法参数详解与$.each()和jquery里面each方法的区别

    JQuery中$.ajax()方法参数详解 url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为g ...