mybatis+spring tomcat启动时报错Mapped Statements collection already contains value for com.**.insertMenu!selectKey
Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.rx.mapper.SecurityMapper.insertMenu!selectKey
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:98)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 50 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.rx.mapper.SecurityMapper.insertMenu!selectKey
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$SelectKeyHandler.handleNode(XMLStatementBuilder.java:221)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseSelectKey(XMLStatementBuilder.java:167)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:91)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parsePendingStatements(XMLMapperBuilder.java:171)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:138)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:111)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:60)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:532)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:95)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:98)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 50 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.rx.mapper.SecurityMapper.insertMenu!selectKey
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$SelectKeyHandler.handleNode(XMLStatementBuilder.java:221)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseSelectKey(XMLStatementBuilder.java:167)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:91)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parsePendingStatements(XMLMapperBuilder.java:171)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:138)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:111)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:60)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:532)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:95)
... 53 more
这么写有问题吗?去掉selectKey运行tomcat不会报错....有谁知道的,可以说下吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢你的回复...终于找到问题的所在了...parameterMap改成parameterType...真的是粗心了我...
http://www.cnblogs.com/yangchao/archive/2010/09/28/2044415.html
<selectKey resultClass="long" keyProperty="id">
select SEQ_USER_ID.nextval as id from dual
</selectKey>