zoukankan      html  css  js  c++  java
  • Result Maps collection already contains value for com.cq.zys.dao.StudentMapper.BaseResultMap

    在ssm整合时,因为是自动生成的代码,后来因为手贱把一个实体类删了,忘记把mapper一起删就开始重新生成实体了

    结果报错:nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentMapper' defined in file [D: ekoworkspacessmAngular argetclassescomcqzysdaoStudentMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D: ekoworkspacessmAngular argetclassescomcqzysmappingStudentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause:  Result Maps collection already contains value for com.cq.zys.dao.StudentMapper.BaseResultMap

    后来找了很久突然发现mapper.xml居然出现了追加部分,即:

    <id column="emp_id" jdbcType="BIGINT" property="emp_id" />
        <result column="work_number" jdbcType="VARCHAR" property="work_number" />
        <result column="role_id" jdbcType="INTEGER" property="role_id" />
        <result column="photo" jdbcType="VARCHAR" property="photo" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="gender" jdbcType="VARCHAR" property="gender" />
        <result column="telephone" jdbcType="VARCHAR" property="telephone" />
        <result column="max_advisory" jdbcType="INTEGER" property="max_advisory" />
        <result column="introduction" jdbcType="VARCHAR" property="introduction" />
        <result column="state" jdbcType="VARCHAR" property="state" />
        <result column="create_time" jdbcType="TIMESTAMP" property="create_time" />
      </resultMap>这个都出现了三遍,刚好是我重新生成代码的次数,所以原因出来了:

    原因:每次自动生成代码前,要把之前已有的mapper.xml和java类一起删了,不然每次自动生成时,

    会在已有的xml文件上追加新增部分,不会覆盖而是追加,不是覆盖,不是覆盖,把重复部分删了就解决了

  • 相关阅读:
    微信端调取相册和摄像头,实现图片上传,并上传到本地服务器
    js 跳转链接的几种方式
    JS 导出表格
    This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed
    错误: 未能完成程序集的安装(hr = 0x8007000b)。探测终止。
    sql server ISNULL失效
    JS 实现加载中转圈效果
    .net core 分页控件X.PagedList.Mvc.Core
    JS 将table内未显示完全内容显示完全
    .net core viewbag 传递list 或 model
  • 原文地址:https://www.cnblogs.com/crazy-yyl/p/7309759.html
Copyright © 2011-2022 走看看