Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for furn.da

在给用Mybatis逆向生成的JavaBean添加上无参构造器和全参构造器后,:
在这里插入图片描述
测试给数据库增删改查时,出现了报错问题:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\JavaCode\furn-ssm\target\classes\mapper\FurnMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\JavaCode\furn-ssm\target\classes\mapper\FurnMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for furn.dao.FurnMapper.BaseResultMap

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [E:\JavaCode\furn-ssm\target\classes\mapper\FurnMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [E:\JavaCode\furn-ssm\target\classes\mapper\FurnMapper.xml]’. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for furn.dao.FurnMapper.BaseResultMap

报错原因:

自己闲的没事逆向了很多次,每次虽然JavaBean和JavaBeanExample都会重新覆盖,但是mapper下的FurnMapper.xml文件不会重新覆盖,而是在原来的基础上继续append。

在这里插入图片描述
这样就相当于在FurnMapper.xml文件中有很多重复的东西,其中一个就是BaseResultMap。

解决方法

所以需要你把FurnMapper.xml删除,然后重新逆向一下。然后重新添加无参和全参构造器。然后就直接去增删改查就可以了
不需要点多次的逆向。

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值