nested exception is org.apache.ibatis.binding.BindingException: Parameter çollection'not found. Available parameters are [depId, userList, operator, param3, param1, param2]
工具:mybatis+pgsql
案例1
dao层
void insert(String depId, String operator, List<User> userList);
sql
<insert id = "insert" parameterType = "java.util.ArrayList">
insert into user (username,sex,depId,create_by)
values
<foreach collection="collection" separator="," item="val">
(#{val.username}, #{val.sex}, #{depId}, #{create_by})
</foreach>
</insert>
执行后抛出异常信息:
"nested exception is org.apache.ibatis.binding.BindingException: Parameter 'collection' not found. Available parameters are [depId, userList, operator, param3, param1, param2]"
错误原因:parameterType = “java.util.ArrayList”