Mapped Statements collection already contains value for ... 报错原因及解决办法


一、Mapped Statements collection already contains value for…

1. 异常报错描述:

Mapped Statements collection already contains value for …
mapped 中执行SQL语句的Statements 对象的集合存在重复的值,存在于…(java.lang.IllegalArgumentException)

在这里插入图片描述

1.1 详细描述1:

Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for cn.tedu.csmall.product.mapper.AlbumMapper.insert. please check file [xxx\xxx…\target\classes\mapper\AlbumMapper.xml]

mapped 中执行SQL语句的Statements 对象的集合存在重复的值,存在于 cn.tedu.csmall.product.mapper.AlbumMapper.insert 中,请检查文件 xxx\xxx...\target\classes\mapper\AlbumMapper.xml

2. 异常报错信息案例:

2.1 案例1:

在这里插入图片描述

2.1.1 异常错误描述:

错误原因:Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for cn.tedu.boot08.mapper.MyProductMapper.insert. please check file [F:\JavaProjects\clone\JSD2207\t-jsd-03\boot08\target\classes\mappers\MyProductMapper.xml] and file [F:\JavaProjects\clone\JSD2207\t-jsd-03\boot08\target\classes\mappers\ProductMapper.xml]

mapped 中执行SQL语句的Statements 对象的集合存在重复的值,存在于 cn.tedu.boot08.mapper.MyProductMapper.insert 中,请检查文件 F:\JavaProjects\clone\JSD2207\t-jsd-03\boot08\target\classes\mappers\MyProductMapper.xml and [F:\JavaProjects\clone\JSD2207\t-jsd-03\boot08\target\classes\mappers\ProductMapper.xml]

2.1.2 解决方案:

解决思路:
1)这里,我们需要先根据报错信息检查报错中让我们检查的两个文件是否为同一个文件。如果为不同文件参考步骤 2 。
2)然后,我们需要再检查我们的 MyProductMapper.xmlProductMapper.xmlnamespace 的值是否重复

2.2 案例2:

在这里插入图片描述

2.2.1 异常错误描述:

错误原因:Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for cn.tedu.csmall.product.mapper.AlbumMapper.insert. please check file [D:\IdeaProjects\clone\JSD2207\jsd2206-csmall-product-teacher\target\classes\mapper\AlbumMapper.xml] and file [D:\IdeaProjects\clone\JSD2207\jsd2206-csmall-product-teacher\target\classes\mapper\AlbumMapper.xml]

mapped 中执行SQL语句的Statements 对象的集合存在重复的值,存在于 cn.tedu.csmall.product.mapper.AlbumMapper.insert 中,请检查文件 D:\IdeaProjects\clone\JSD2207\jsd2206-csmall-product-teacher\target\classes\mapper\AlbumMapper.xml and [D:\IdeaProjects\clone\JSD2207\jsd2206-csmall-product-teacher\target\classes\mapper\AlbumMapper.xml]

2.2.2 解决方案:

解决思路:
1)这里,我们需要先根据报错信息检查报错中让我们检查的两个文件是否为同一个文件。如果为同一个文件参考步骤 2 。
2)然后,我们需要再检查我们的 AlbumMapper.xml 中的 id 为 insert 是否有重复的

在这里插入图片描述

  • 未完待续…
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值