使用mybatis进行一对多嵌套查询时出错,错误原因:

    <select id="findMinisterById" resultMap="com.abc.beans.Minister">
select mid,mname from minister where countryId = #{cid}
</select>
<resultMap id="AndSelectCountry" type="com.abc.beans.Country">
<id property="id" column="cid"/>
<result property="name" column="cname"/>
<collection property="minister"
column="cid"
ofType="com.abc.beans.Minister"
select="findMinisterById">
</collection>
</resultMap>
<select id="findById" resultMap="AndSelectCountry">
select cid,cname from country where cid = #{id}
</select>
</mapper>

java.lang.IllegalArgumentException: Result Maps collection does not contain value for xxxx.xxx
解决办法:
1.检查mybatis的xml配置
2.在某处肯定有配错了的,如"resultMap" -->“resultType”

像我这样的因为findMinisterById查询时,返回的是com.abc.beans.Minister类型,此时如果该实体类和对应的表属性值一致,就要把这个标红的resuitMap改为resultType

org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.abc.beans.Minister的更多相关文章

  1. org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.Integer

    如图: 详细错误信息如下: org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.l ...

  2. org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.hp.entity.Emp

    错误提示代码: org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.hp.entit ...

  3. org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.util.HashMap

    这样的配置有问题吗? <select id="getFreightCollectManagementList" resultMap="java.util.HashM ...

  4. 【mybatis】mybatis方法访问报错:org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.pisen.cloud.luna.ms.goods.base.domain.GoodsConfigQuery

    在调用mapper.xml中的方法的时候,报错: org.apache.ibatis.builder.IncompleteElementException: Could not find result ...

  5. org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.hyzn.historicalRecord.dao.ITB_HISTORYLOGDAO.TB_HISTORYLOGResultMap

    用了很久的myBatis,忽然出现这个错误,感觉配置什么的都是正确的,错误如下: org.apache.ibatis.builder.IncompleteElementException: Could ...

  6. MyBatis的mapper.xml文件的参数问题:org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map

    配置参数类型有两种选择,即:parameterType和parameterMap 不管参数是否是基本数据类型还是map类型,都是使用parameterType. 版权声明:本文为博主原创文章,未经博主 ...

  7. org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map

    mybatis 出现这个错误是 参数类型写错了.parameterType 写成了parameterMap

  8. [springMVC - 1A] - Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException

    一月 14, 2016 1:30:07 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for ...

  9. Mybatis报错:org.apache.ibatis.builder.IncompleteElementException

    org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.lang.Integer遇到这 ...

随机推荐

  1. Java学习之构造函数

    构造函数特点:  函数名和类名相同  没有返回值(不用定义返回值类型)作用:  对象初始化注意:  如果类没有定义构造函数时,系统会默认定义一个无参的构造函数  如果定义了构造函数,系统不会定义构造函 ...

  2. upc组队赛5 Ingenious Lottery Tickets【排序】

    Ingenious Lottery Tickets 题目描述 Your friend Superstitious Stanley is always getting himself into trou ...

  3. LINUX 安装PHP GD库遇到的坑

    本文借鉴:https://www.cnblogs.com/gaohj/p/3152646.html linux下为php添加GD库的步骤如下: 一.下载 gd-.tar.gz http://www.b ...

  4. QQ邮箱客户端配置

    接收协议:IMAP 接收邮箱服务器地址:imap.qq.com 端口:993 加密方法:TLS 发送协议:SMTP 发送服务器:smtp.qq.com 端口:465 加密方法:TLS

  5. 27-python基础-python3-异常处理(try except)

    到目前为止,在 Python 程序中遇到错误,或“异常”,意味着整个程序崩溃.不希望这发生在真实世界的程序中. 相反,希望程序能检测错误,处理它们,然后继续运行.   实例1: 当试图用一个数除以零时 ...

  6. Java中使用File类删除文件夹和文件

    删除工具类: import java.io.File; public class DeleteAll{ public static void deleteAll(File file){ if(file ...

  7. Android开发:Handler的简单使用(一)

    1.Handler是什么? 原文: A Handler allows you to send and process Message and Runnable objects associated w ...

  8. tcp - 传输控制协议 (TCP)

    总缆 SYNOPSIS #include <sys/socket.h> #include <netinet/in.h> tcp_socket = socket(PF_INET, ...

  9. mysql的事务四个特性以及 事务的四个隔离级别

    一.事务四大属性 分别是原子性.一致性.隔离性.持久性. 1,原子性(Atomicity) 原子性是指事务包含的所有操作要么全部成功,要么全部失败回滚,因此事务的操作如果成功就必须要完全应用到数据库, ...

  10. ZedGraph怎样在生成曲线时随机生成不一样的颜色

    场景 在使用ZedGraph生成多条曲线时为了能区分曲线颜色,要求随机设置曲线颜色. 首先从System.Drawing.Color中获取所有颜色的对象的数组,然后将其顺序打乱随机排序,然后在生成曲线 ...