mybatis批量insert时使用foreach发生Parameter '***' not found. Available parameters are [collection, list]错误
报错情况如下org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘stocksList’ not found. Available parameters are [stockList, param]这句话的大概意思是.
·
报错情况如下org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘stocksList’ not found. Available parameters are [stockList, param]
这句话的大概意思是你找不到你传进来的参数
后来我发现是我collection里定义的参数“stocksList”没找到,最后发现只要把
mapper.java文件中方法参数从
加@Param(“stocksList”)修改为
就行了,最后总结一下@Param中的参数应该要与Collection属性参数相同
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)