项目启动时报错:Result Maps collection already contains value for com.xxx.xxx.xx.mapper.XxxMapper.baseResultMap

Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxx.xxx.xx.mapper.XxxMapper.BaseResultMap

这个问题纠结了我一两个小时, 百度找了好久里面的回答很多,但是都没能让我理解

这是一个使用Mybatis逆向工程生成的一堆文件中的一个, 很多回答说是因为重复,其实我也知道是重复了,毕竟

我用刚过六级的英语水平看这句话 -- 很明显在报错的xml文件中,出现了重复的 baseResultMap

<resultMap id="BaseResultMap" type="com.practise.pojo.Student">    <id column="id" property="id" jdbcType="BIGINT"/>    <result column="spec_name" property="specName" jdbcType="VARCHAR"/></resultMap>

然后下面的引用了两次定义的这个  BaseResultMap
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.practise.pojo.TbSpecificationExample">
    select    <if test="distinct">        distinct    </if>    <include refid="Base_Column_List"/>    from tb_specification    <if test="_parameter != null">        <include refid="Example_Where_Clause"/>    </if>    <if test="orderByClause != null">        order by ${orderByClause}    </if></select><select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">    select    <include refid="Base_Column_List"/>    from tb_specification    where id = #{id,jdbcType=BIGINT}</select>

但是这两个不同的方法都得用这个返回的结果集吧 我就复制了一个ResultMap,不过换了个名字 -- 在后面家里个s,得到下面的效果
<resultMap id="BaseResultMaps" type="com.practise.pojo.Student">    <id column="id" property="id" jdbcType="BIGINT"/>    <result column="spec_name" property="specName" jdbcType="VARCHAR"/></resultMap>
<resultMap id="BaseResultMap" type="com.practise.pojo.Student">    <id column="id" property="id" jdbcType="BIGINT"/>    <result column="spec_name" property="specName" jdbcType="VARCHAR"/></resultMap>
<select id="selectByExample" resultMap="BaseResultMaps" parameterType="com.practise.pojo.TbSpecificationExample">
    select    <if test="distinct">        distinct    </if>    <include refid="Base_Column_List"/>    from tb_specification    <if test="_parameter != null">        <include refid="Example_Where_Clause"/>    </if>    <if test="orderByClause != null">        order by ${orderByClause}    </if></select><select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">    select    <include refid="Base_Column_List"/>    from tb_specification    where id = #{id,jdbcType=BIGINT}</select>
现在再次启动服务器,就没毛病了,希望大家带代码都是一次过,别像我一样搞了个把小时

      



原文地址:https://www.cnblogs.com/qiyifeng/p/9746355.html

时间: 2024-07-31 19:48:15

项目启动时报错:Result Maps collection already contains value for com.xxx.xxx.xx.mapper.XxxMapper.baseResultMap的相关文章

mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap

由于mybatis简单易学,比起Hibername来,更容易上手,代码也能自动生成.这几天研究了下代码自动生成的,参考: http://0609xiaohua.iteye.com/blog/1453570 但是把代码复制进来,运行了下,却跑不起来,报以下错误: Exception in thread "main" java.lang.ExceptionInInitializerError at com.test.Test.main(Test.java:12)Caused by: org

maven项目或者SpringBoot项目启动时报错在本地仓库中找不到jar包的解决办法

经常遇到项目检出来后是导入开发工具eclipse中pom文件出错问题,项目启动时遇到了一些列的jar包找不到的问题,所以换个开发平台到IDEA以为会好些,结果同样的问题还是会出现的,为了找到具体的解决办法,针对以下我遇到的此类问题做总结,希望能帮助到一部分人,所以帮我此次的解决办法记录下来,帮助大家也方面自己. 一.问题现象 二.解决办法 (1)从报错截图中大概知道是因为在本地的maven仓库中找不到“mchange-commons-java-0.2.9.jar ”这个jar包 所以就到本地的m

项目启动时报错Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError

https://www.cnblogs.com/liuyp-ken/p/7911536.html 解决过程: 1.检查配置,反反复复看了很多遍,确认没有问题. 2. 网上找了很多资料,类似的问题很多,看过答案以后依旧不得其要领.只好继续看报错代码,直到看到这一句: 1 2 3 4 Caused by: java.lang.NullPointerException     at ***.***.SearchIPAttributionService.load(SearchIPAttributionS

解决前端项目启动时报错:Use // eslint-disable-next-line to ignore the next line.

首先说一下这个问题产生的原因: 项目创建时设置了使用 eslint 进行代码规范检查. 解决办法: 找到webpack.base.conf.js文件,并且将下满这行代码注释掉. ...(config.dev.useEslint ? [createLintingRule()] : []), 具体位置如下图所示: 接下来重新使用执行  npm run dev  就可以了. 原文地址:https://www.cnblogs.com/belongs-to-qinghua/p/12343532.html

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

解决办法:1.检查mybatis的xml配置 2.在某处肯定有配错了的,如"resultMap" -->"resultType" [html] view plain copy<select id="getNumDayMoney" resultMap="java.lang.Integer" parameterType="java.lang.Integer"> <![CDATA[ sel

mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案

Result Maps collection already contains value for xyx.dsw.dao.mapper.admin.quotationwish.TempTestTableMapper.TempTestTableResult 一  错误信息: [html] view plain copy 19:26:05,446 ERROR [org.mybatis.spring.mapper.MapperFactoryBean] (org.mybatis.spring.mapp

Spring Boot Mybatis Result Maps collection already contains value for *.BaseResultMap

当你复制一个*Mapper.xml文件到项目工程中,运行报错Mybatis Result Maps collection already contains value for *.BaseResultMap时,教你两步解决. 1.删除对应的这个*Mapper.xml文件,启动下项目,让其报下错. 2.然后再复制文件上去,再次启动就OK了.

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

今天在写项目的时候遇到一个问题如下: 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.

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

Result Maps collection does not contain value for java.lang.String 以上是我报的错. 只要报Result Maps collection does not contain value for*****的错误都是同一种错误. 问题排查: 从异常信息里无法看出具体是哪里出了错误.只提示调用出现错误的地方.但是经过检查后明显错误不是再此处的代码. 经过每个问题文件进行移除,一次次运行进行排查问题最终找到了错误的地方,处于一个xml里面的