org.apache.ibatis.binding.BindingException: Parameter 'receptionList' not found. Available parameter
来源:互联网 发布:c语言学习班 编辑:程序博客网 时间:2024/06/05 15:39
今天遇到mybatis批量保存报错
org.apache.ibatis.binding.BindingException: Parameter 'receptionList' not found. Available parameters are [list, collection]
就其原因是因为在xml中写SQL的时候
<insert id="batchInsert" parameterType="smsReceptionList">
INSERT INTO t_sms_reception
(
SMS_SYS,
SUBCODE,
PHONE_NUM,
SMS_CONTENT,
REQUEST_TIME,
READ_FLAG
)
VALUES
<foreach collection="list" separator ="," item="smsReception">
(
#{smsReception.smsSys},
#{smsReception.subcode},
#{smsReception.phoneNum},
#{smsReception.smsContent},
#{smsReception.readFlag}
)
</foreach>
</insert>
根据报错日志分析,是MyBatis在解析xml时找不到其中声明的studentNameList,但是在Dao中明明传的参数就是studentNameList,怎么会报错呢?
查询了一下MyBatis官方的说明文档,终于找到了原因,在http://mybatis.github.io/mybatis-3/zh/dynamic-sql.html#foreach里有一段说明:
因为我传的参数只有一个,而且传入的是一个List集合,所以mybatis会自动封装成Map<"list",studentNameList>。在解析的时候会通过“list”作为Map的key值去寻找。但是我在xml中却声明成studentNameList了,所以自然会报错找不到。
- org.apache.ibatis.binding.BindingException: Parameter 'receptionList' not found. Available parameter
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis多参数查询问题:org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available par
- org.apache.ibatis.binding.BindingException: Parameter 'List' not found. Available parameters are [l
- Caused by: org.apache.ibatis.binding.BindingException: Parameter 'offset' not found. Available param
- org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [1,
- Caused by: org.apache.ibatis.binding.BindingException: Parameter 'stuId' not found. Available parame
- org.apache.ibatis.binding.BindingException: Parameter 'id' not found.Available parameters are [0, 1,
- mybatis多参数查询问题:org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available par
- org.apache.ibatis.binding.BindingException: Parameter 'set' not found
- org.apache.ibatis.binding.BindingException: Parameter '__frch_org_0' not found
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'title' not found.
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'param' not found.
- mybaits异常:org.apache.ibatis.binding.BindingException: Parameter 'date' not found.
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'title' not found.
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'loginId' not found.
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'loginId' not found.
- Jar命令构建jar包
- 阿里云主机搭建lamp环境
- spark core 2.0 LiveListenerBus
- android7.0-PopupWindow-showAsDropDown
- JSP简介
- org.apache.ibatis.binding.BindingException: Parameter 'receptionList' not found. Available parameter
- 常用的几种文件封装格式
- 线性回归
- 浏览器的缓存究竟是什么?为什么j2ee的web工程的js明明修改了,但是浏览器中展示的,并没有改变,还是之前的,即和j2ee的web工程的代码中的不一致
- Android:布局实例之常见用户设置界面
- Linux中函数返回值错误码对照表(1-133)
- 问题3:mysql explain执行计划查看
- center for tourism
- Intellij IDEA快捷键大全- Intellij IDEA常用快捷键