Parameter 'xxx' not found. Available parameters are [collection, list]
程序员文章站
2022-06-24 12:50:53
mybatis报错问题: 运行报错:Parameter 'listType' not found. Available parameters are [collection, list] 解决:1.通用方法,在dao层参数上加上@Param("listType"),所以养成加@Param是个好习惯 ......
mybatis报错问题:
dao层: List<HqjTrade> queryHongbao(ArrayList<String> listType); 映射文件下sql: <select id="queryHongbao" resultType="HqjTrade" > select * from hqj_trade where tradetype in <foreach collection="listType" open="(" close=")" separator="," item="tradetype"> #{tradetype} </foreach> </select>
运行报错:Parameter 'listType' not found. Available parameters are [collection, list]
解决:1.通用方法,在dao层参数上加上@Param("listType"),所以养成加@Param是个好习惯
2.将sql中Collection="listType"改为 Collection="list"或者"collection"
3.对应方式处理二,如果参数是数组则这么改: Collection="array"
注意:也不是任何参数之前就加上@Param,实体类之前不需要加上注解@Param
会报org.apache.ibatis.binding.BindingException: Parameter 'xx' not found
推荐阅读
-
Parameter '***' not found. Available parameters are [0, 1, param1, param2]
-
Parameter 'xxx' not found. Available parameters are [collection, list]
-
mybatis使用foeach批量删除报Parameter ‘array‘ not found. Available parameters are [collection, list]
-
Mybaits 传入多个参数时报错Parameter 'XXXX' not found. Available parameters are [arg1, arg0, param1, param2]
-
Mybatis报错:org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters
-
Parameter 'xxx' not found. Available parameters are [collection, list]
-
mybatis使用foeach批量删除报Parameter ‘array‘ not found. Available parameters are [collection, list]