MyBatis错误:Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseRes

Posted Faron

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyBatis错误:Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseRes相关的知识,希望对你有一定的参考价值。

 

 

 

今天在写项目的时候遇到一个问题如下:

org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in NovelMapper.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. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseResultMap

 

原因分析

发现时Mybatis-Generator在生成Mapper.xml文件时,会在原来xml的基础上再追加相同的内容,导致内容重复。报错!

所以找到MyBatis自动生成的文件全部删除,重新进行生成即可。

 

之后重新生成一次就好!

感谢错误!

 

以上是关于MyBatis错误:Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseRes的主要内容,如果未能解决你的问题,请参考以下文章

MyBatis错误:Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseRes

mybatis 异常Result Maps collection does not contain value for java.lang.String

Mybatis异常_02_Result Maps collection already contains value for

A query was run and no Result Maps were found for...原来是mapper.xml文件出了问题,是使用MyBatis最常见的一种错误

mybatis 报错Result Maps collection does not contain value for java.lang.Integer

MyBatis 之Result Maps最精华部分