开发者社区> 问答> 正文

mybatis+spring tomcat启动时报错Mapped Stateme?报错

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)

... 53 more


这么写有问题吗?去掉selectKey运行tomcat不会报错....有谁知道的,可以说下吗?

展开
收起
爱吃鱼的程序员 2020-06-22 21:43:12 771 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    http://www.cnblogs.com/yangchao/archive/2010/09/28/2044415.html

    <selectKeyresultClass="long"keyProperty="id"> 
         selectSEQ_USER_ID.nextvalasidfromdual 
    </selectKey>

    感谢你的回复...终于找到问题的所在了...parameterMap改成parameterType...真的是粗心了我...
    2020-06-22 21:43:28
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多