Mbatis逆向工程常遇错误

Posted jackphang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mbatis逆向工程常遇错误相关的知识,希望对你有一定的参考价值。

org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in com/guigu/mapper/BookMapper.xml
### The error occurred while processing mapper_resultMap[BaseResultMap]
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘com/guigu/mapper/BookMapper.xml‘. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.guigu.mapper.BookMapper.BaseResultMap

 

这错误主要是自动生成的Mapper文件被重叠了。

 

解决办法一:

把生成的所有文件删除,包括包,并检查文件目录是否还存在;然后重新生成。

这样也可能会出现同样的问题,本人就是在多次清理还不成的情况下使用了第二种。

 

解决办法二:

找到所有生成的Mapper,删除重复的[BaseResultMap]

 

以上是关于Mbatis逆向工程常遇错误的主要内容,如果未能解决你的问题,请参考以下文章

SpringBoot整合Mbatis

Mbatis——动态SQL

Mbatis是什么?怎么运行?

Mbatis Oracle 第一次插入失败 useGeneratedKeys

spring+springmvc+mbatis+maven+velocity构建javaEE项目

SEO新手常遇哪些问题?SEO新手常遇问题与解答