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 ...
随机推荐
- 监控系统-mod-gearman
doc http://labs.consol.de/nagios/mod-gearman/ 安装 yum -y install gearmand-server-0.33-2.rhel6.x86_64. ...
- centos6.5_64bit-禅道安装及数据库操作
linux一键安装包内置了apache, php, mysql这些应用程序,只需要下载解压缩即可运行禅道. 从7.3版本开始,linux一键安装包分为32位和64位两个包,请大家根据操作系统的情况下载 ...
- Cholesky分解(Cholesky decomposition / Cholesky )
Cholesky decomposition In linear algebra, the Cholesky decomposition or Cholesky is a decomposition ...
- IOS 控制当前控制器支持哪些方向
#pragma mark - 实现这个方法来控制屏幕方向 /** * 控制当前控制器支持哪些方向 * 返回值是UIInterfaceOrientationMask* */ - (NSUInteger) ...
- 是否应该提供一个dao.insertIgnoreNull ? (像updateIgnoreNull一样)
是否应该提供一个dao.insertIgnoreNull ? (像updateIgnoreNull一样) 发布于 406天前 作者 SayingCode 153 次浏览 复制 上一个帖子 ...
- 【转】css行高line-height的一些深入理解及应用
一.前言 前两天在腾讯ISD团队博客上看到一篇翻译的文章“深入理解css 行高”,是个不错的文章,学到了不少东西,建议您看看. 这里,我也要讲讲我对line-height的一些理解,所讲解的东西绝大多 ...
- LSD-SLAM使用方法
preparation:按照官網步驟完成LSD的安裝. 1.testdata:need images file & cameraCalibration.cfg 2.開啟終端機 -> ...
- 统计函数运行时间-CPU端
C/C++中的计时函数是clock(),而与其相关的数据类型是clock_t.在MSDN中,查得对clock函数定义如下: clock_t clock( void ); 这个函数返回从“开启这个程序 ...
- putty乱码问题
1.将linux系统编码设置为utf-8 #vi /etc/sysconfig/i18n #设置为如下内容: LANG="en_US.UTF-8" SYSFONT="la ...
- 子div作为遮罩层
效果图: 子div的代码: