Result Maps collection does not contain value for XXXXX
在做mybatis多表查询的时候,出现了下面的错误:
java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.up.sell.mapper.system.AdvertisementMapper.areasResult
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:640) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getNestedResultMap(DefaultResultSetHandler.java:1011) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyNestedResultMappings(DefaultResultSetHandler.java:945) ~[mybatis-3.4.6.jar:3.4.6]
意思很明确,是ResultMap映射出现了问题,下面贴上映射代码:
<resultMap type="Advertisement" id="AdvertisementResult">
<id property="id" column="id" />
<result property="title" column="title" />
<result property="imgPath" column="img_path" />
<result property="url" column="url" />
<result property="description" column="description" />
<result property="sorrt" column="sorrt" />
<result property="place" column="place" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="advFlag" column="adv_flag" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<association property="provinceId" column="id" javaType="Areas" resultMap="areasResult"/>
</resultMap>
我的sql代码:
<select id="findList" parameterType="Advertisement" resultMap="AdvertisementResult">
SELECT
a.id ,
a.title ,
a.img_path ,
a.url ,
a.description ,
a.sort ,
s.area_name ,
s1.short_name
FROM
advertisement a
LEFT JOIN areas s ON
a.province_id = s.id LEFT JOIN areas s1 on a.city_id
= s1.id
</select>
我是把关联表的resultMap忘记写了,加上之后就好了,代码如下:
<resultMap id="areasResult" type="Areas">
<id property="id" column="id" />
<result property="areaName" column="area_name" />
<result property="parentId" column="parent_id" />
<result property="shortName" column="short_name" />
</resultMap>
主表的resultMap和副表的resuleMap Id是对应的。
Result Maps collection does not contain value for XXXXX的更多相关文章
- java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.lang.Integer
今天做springmvc+mybatis+spring的项目的时候发现了一个异常.如下: org.apache.ibatis.builder.IncompleteElementException: C ...
- Result Maps collection already contains value for
Result Maps collection already contains value for select s.id,s.branch_name from t_wx_shop s left jo ...
- mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap--转
转自:http://blog.csdn.net/tan3739/article/details/7555665 Exception in thread "main" Java.la ...
- nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoSupport': ...
- mybatis Result Maps collection already contains value for com.ebways.dictionary.dao.impl.PtInfoDaoImpl.beanMap
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...
- 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 proc ...
- mybatisGenerator 代码自动生成报错 Result Maps collection already contains value for BaseResultMap【转】
由于mybatis简单易学,比起Hibername来,更容易上手,代码也能自动生成.这几天研究了下代码自动生成的,参考: http://0609xiaohua.iteye.com/blog/14535 ...
- java.lang.IllegalArgumentException: Result Maps collection already contains value for
如果在SSM整合的时候出现以下的错误: 留意一下是不是既在Mybatis配置文件中加载了映射文件,又在Spring配置文件中使用扫描式去加载映射文件了.两者是不能够重合使用的! Caused by: ...
- 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 collectio ...
随机推荐
- vos忙时闲时费率不一样怎么设置
问题: 现有一客户要求上午闲时由原来的9:00追加到9:30 即: 9:30——12:00为忙时 14:00——18:00为忙时 其他为闲时 忙时费率为0.04元即4分 闲时费率为0.025元即2分5 ...
- Linux安装中文字体包
进入rhel5.5安装盘/Server路径找到字体安装包: fonts-chinese-3.02-12.el5.noarch.rpm fonts-ISO8859-2-75dpi-1.0-17.1.no ...
- 音乐代码 (DNF天空之城、欢乐颂)。
太感人了 DNF天空之城 #include <cstdio> #include <windows.h> #define qdo 262 #define qre 294 #def ...
- 1923. Scary Politics (timus) (dfs) search
http://acm.timus.ru/problem.aspx?space=1&num=1923 -- timus This is s problem about thd dfs and s ...
- vue项目里的日期格式化(摘录)
export function formatDate (date, fmt) { if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (date. ...
- Linux内存管理 - slab分配器和kmalloc
本文目的在于分析Linux内存管理机制的slab分配器.内核版本为2.6.31.1. SLAB分配器 内核需要经常分配内存,我们在内核中最常用的分配内存的方式就是kmalloc了.前面讲过的伙伴系统只 ...
- P1774 最接近神的人_NOI导刊2010提高(02)
P1774 最接近神的人_NOI导刊2010提高(02) 关于此题为什么可以使用求逆序对的方法来做 假设一个数\(a_i\),且前\(i-1\)个数已经成为单调增的数列. 我们要从前\(a_1\)至\ ...
- P2096 最佳旅游线路
最大字段和加贪心 算长了个见识吧 #include<iostream> #include<cstdio> #include<algorithm> using nam ...
- 在Linux上部署Kettle环境
首先我们有一个正常安装的,桌面版的Linux. Kettle的应用程序是Linux版本与Windows版本在同一个文件夹下共存的,所以可以直接把本机上的Kettle解压,通过FTP工具上传到Linux ...
- Webpack4 学习笔记五 图片解析、输出的文件划分目录
前言 此内容是个人学习笔记,以便日后翻阅.非教程,如有错误还请指出 webpack打包图片和划分文件路径 使用图片的方式 通过 new Image() 在 css中设置 background-imag ...