欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mybatis报错: Mapped Statements collection already contains value for xxx

程序员文章站 2022-03-08 15:57:53
...

具体报错如下:

Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for onion.dao.contentcheck.ClassAnnouncationDao.selectCount
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:657)
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:629)
	at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:462)
	at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:296)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:113)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:121)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:111)
	... 67 more

产生原因:Mapper.xml文件所采用的SQL语句映射通过语句的ID进行区分,不仅仅是同一Mapper文件内语句ID不相同,所有配置内的Mapper文件内不能存在相同的语句ID,修改其中之一就行了

相关标签: mybatis