MyBatis:Parameter Maps collection does not contain value for 的问题解决

发现配置:

Java代码  

  1. <resultMap type="com.demo.sys.entity.Module" id="moduleMap">
  2. <id property="id" column="id" />
  3. <result property="name" column="name" />
  4. <result property="remark" column="remark" />
  5. <result property="createDate" column="createdate" />
  6. <result property="updateDate" column="updateDate" />
  7. <association property="parent" column="parent_id"
  8. resultMap="moduleMap" select="queryModule">
  9. </association>
  10. <collection property="childs" column="parent_id"
  11. javaType="ArrayList" ofType="com.demo.sys.entity.Module"
  12. select="queryChildList">
  13. </collection>
  14. </resultMap>
  15. <select id="queryList" parameterMap="moduleMap" resultMap="moduleMap">
  16. select * from sys_module where id =#{id}
  17. </select>

更改配置:

Java代码  

  1. <resultMap type="com.demo.sys.entity.Module" id="moduleMap">
  2. <id property="id" column="id" />
  3. <result property="name" column="name" />
  4. <result property="remark" column="remark" />
  5. <result property="createDate" column="createdate" />
  6. <result property="updateDate" column="updateDate" />
  7. <association property="parent" column="parent_id"
  8. resultMap="moduleMap" select="queryModule">
  9. </association>
  10. <collection property="childs" column="parent_id"
  11. javaType="ArrayList" ofType="com.demo.sys.entity.Module"
  12. select="queryChildList">
  13. </collection>
  14. </resultMap>
  15. <select id="queryList"  parameterType="com.demo.sys.entity.Module" resultMap="moduleMap">
  16. select * from sys_module where id =#{id}
  17. </select>

parameterMap="moduleMap" -------》parameterType="com.demo.sys.entity.Module"

解决了Mybatis中Parameter Maps collection does not contain value for xxx 的问题了。

查看Mybatis官方资料:

SQL映射的XML文件:parameterMap 已经废弃了,现在使用parameterType来处理。

时间: 2024-11-06 13:52:12

MyBatis:Parameter Maps collection does not contain value for 的问题解决的相关文章

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中Invalid bound statement (not found) 和 Result Maps collection already contains value for...错误解决方案

一.Invalid bound statement (not found) 使用mybatis有时候会报Invalid bound statement (not found)这种错误,总结了下,可能有两种情况如下: 1.mybatis的对应的mapper.xml找不到对应的命名sql或者名称与mapper接口名称不一致. 2.xml文件与接口名称都对,但是在mybatis配置文件中漏掉了配置,也会报这种错误. 二.Result Maps collection already contains v

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

Mybatis异常_02_Result Maps collection already contains value for

一.异常 1.异常信息 2.异常原因 XXXMapper.xml文件中存在重名对象,保持名称不要一样即可正常启动. 二.参考资料 1.Mybatis启动报Result Maps collection already contains value for ...的问题 1.mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案 2.Mybatis异常-Result Maps collection

MyBatis出错Result Maps collection does not contain value for java.lang.Integer

Servlet.service() for servlet [SpringMVC] in context with path [/eyou] threw exception [Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.Integer] with root causej

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里面的

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

解决Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.geek.dao.ContentDao.Integer

mybatis报错:Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.geek.dao.ContentDao.Integer 出错原因:一个手误 <select id="selectAllFirstNavigationName" resultMap="firstNavigation"> SELECT fi