mybatis 批量增加 Parameter '__frch_item_0' not found. Available parameters are [list]
当在mybatis用到foreach的时候,会报这个错误Parameter '__frch_item_0' not found. Available parameters are [list]会出现的几种解决方案
例子
- <insert id="insertBatchPicAttachment" parameterType="java.util.List">
- insert into pic_attachment
- (pic_id,pic_udid,relate_id,relate_code,relate_code_dtl,pic_name,pic_url,pic_remote_url)
- values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.picId},#{item.picUdid},#{item.relateId},#{item.relateCode},#{item.relateCodeDtl},#{item.picName},#{item.picUrl},#{item.picRemoteUrl})
- </foreach>
- <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="picId">
- select LAST_INSERT_ID();
- </selectKey>
- </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]的更多相关文章
- mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]
一次在做批量更新数据的时候报错 Parameter '__frch_item_0' not found. Available parameters are [list] 记过反复查找,最后才发现是一个 ...
- 解决使用mybatis做批量操作时发生的异常:Parameter '__frch_item_0' not found. Available parameters are [list] 记录
本文主要描述 使用mybatis进行批量更新.批量插入 过程中遇到的异常及总结: 首先贴出使用批量操作报的异常信息: java.lang.RuntimeException: org.mybatis.s ...
- 解决mybatis foreach 错误: Parameter '__frch_item_0' not found
解决mybatis foreach 错误: Parameter '__frch_item_0' not found 在遍历对象的属性(是ArrayList对象)时报错: org.mybatis.spr ...
- 解决Parameter '__frch_item_0' not found. Available parameters 问题
1. 问题描述: 出现如下问题,执行报错信息 Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org ...
- mybatis批量增加与删除——(十五)
1.首先应该明白,mybatis增删改返回值是int型的影响行数的值 mapper接口 package cn.xm.mapper; import java.util.List; import cn.x ...
- 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. ...
- IDEA下运行 mybatis报错 Parameter 'arg0' not found. Available parameters are [autoRecharge, id, param1, param2]
电脑换系统之后重新安装一了 一下idea 项目运行时出现了以下错误, [autoRecharge, id, param1, param2] 或 [arg0, id, arg1, param2] 参考地 ...
- Mybatis传多个参数的问题 及MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1 问题
对于使用Mybatis ,传多个参数,我们可以使用对象封装外,还可以直接传递参数 对象的封装,例如查询对象条件basequery对象 <select id="getProductByP ...
- Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]
GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegra ...
随机推荐
- sql 的REPLACE
REPLACE 用第三个表达式替换第一个字符串表达式中出现的所有第二个给定字符串表达式. 语法 REPLACE ( 'string_expression1' , 'string_expression2 ...
- .net 任务(Task)
1. Task (任务): 很容易调用 ThreadPool.QueueUserWorkItem 实现异步操作,但是这个技术有许多 .net 引入Task类型来使用任务. 如下几种方式都是实现异步的方 ...
- Arduino I2C + 气压传感器LPS25H
LPS25H是ST生产的MEMS数字气压传感器.主要特性有: 测量范围:260 ~ 1260 hPa绝对气压 分辨率:均方根1 Pa 工作电压:1.7 ~ 3.6 V 功耗:4μA(低分辨率模式)~2 ...
- 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 ...
- 用Visual Studio 2015 编译张帆的第一个NT式驱动,并且成功安装到Windows XP里面!!!
开发工具:Visual Studio 2015 企业版 目 标 机:Windows XP X86 前提:我们已经成功安装了Visual Studio 2015以及WDK,而且更重要一点是一定要SDK版 ...
- 非固定参数:*args和 **kwargs
先看一个固定参数栗子: def func1(x, args): print(x, args) func1(1,22) ====================1 22 ================ ...
- mysqldump导出数据不带时区信息的问题
今天在导出数据时,发现所有timestamp字段都不带时区信息,因为我在东8区,导出的数据中所有时间都提早了8个小时 首先先看表的字段和数据 CREATE TABLE IF NOT EXISTS `a ...
- docker部署sftp
一. 按照我博客中搭建sftp的方法做一个docker镜像 这种方法可用,但不是最好的,待改进.可参照另一篇博客:设置多用户不同权限的sftp服务器搭建 1. dockerfile文件如下,当前目录假 ...
- linux设置ip别名
修改文件 # vi /etc/hosts 添加地址和别名 192.168.222.126 s1 ##前面是机器ip,后面是别名 测试 [root@bogon /]# ping s1 PING s1 ( ...
- ajax方法参数详解与$.each()和jquery里面each方法的区别
JQuery中$.ajax()方法参数详解 url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为g ...