逆向工程Generator:项目启动报错Cause: java.lang.IllegalArgumentException: Result Maps collection already

 

重新启动MallTinyApplication的main函数

发现已经无法正常运行,其中有这么一行关键性的错误:

nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML.
The XML location is 'file [D:\developer\github\mall-learning\mall-tiny-02\target\classes\com\macro\mall\tiny\mbg\mapper\PmsBrandMapper.xml]'.
Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.macro.mall.tiny.mbg.mapper.PmsBrandMapper.BaseResultMapCopy to clipboardErrorCopied

表明了PmsBrandMapper.xml文件解析错误,BaseResultMap重复定义。

查看PmsBrandMapper.xml文件

从中可以发现MyBatis Generator生成的mapper.xml文件信息是直接追加在原来的文件上的,并不是直接覆盖,导致了这个错误。 

问题解决

以前一直以为是MyBatis Generator生成的问题,直接删除mapper.xml所在文件夹,重新生成就好了,现在提供一种MyBatis Generator官方提供的解决方法。

升级MyBatis Generator的版本

MyBatis Generator 在1.3.7版本提供了解决方案,我们目前使用的版本为1.3.3。

<!-- MyBatis 生成器 -->
<dependency>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-core</artifactId>
    <version>1.3.7</version>
</dependency>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值