今天遇到一个问题,原来是mapper.xml文件出了问题,是使用MyBatis最常见的一种错误

报错的结果是这样的:

 A query was run and no Result Maps were found for the Mapped Statement 'cn.zrgk.dao.RoleMapper.getRoleList'.  

  It's likely that neither a Result Type nor a Result Map was specified.
	
org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.zrgk.dao.RoleMapper.getRoleList'. 
   It's likely that neither a Result Type nor a Result Map was specified.
org.apache.ibatis.executor.resultset.FastResultSetHandler.validateResultMapsCount(FastResultSetHandler.java:177)
org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:150)
org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57)
org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)
org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)

我的mapper.xml文件中有个查询语句是这样写的:

  大家看看图一,好像根本没有错误,对吗?再看看

  是的,没错,我没有指定这个方法的返回类型,系统无法识别,于是就这样改了一下,发现不报错了

所以平时啊,我们要多多注意这些细节,更要去多加理解

A query was run and no Result Maps were found for...原来是mapper.xml文件出了问题,是使用MyBatis最常见的一种错误的更多相关文章

  1. A query was run and no Result Maps were found for the Mapped Statement 'user.insertUser!selectKey'. It's likely that neither a Result Type nor a Result Map was specified.

    使用mybatis时出现异常问题: 有如下的错误 Error querying database. Cause: org.apache.ibatis.executor.ExecutorExceptio ...

  2. mybatis配置文件xxxx.xml中缺失返回类型的后果A query was run and no Result Maps were found

    使用mybatis时出现异常问题: 有如下的错误 Error querying database.  Cause: org.apache.ibatis.executor.ExecutorExcepti ...

  3. 出错:Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.mgy.mapper.UserMapper.findById'.

    详细出错代码: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.a ...

  4. A query was run and no Result Maps were found for the Mapped Statement

    mybatis测试方法报错: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exec ...

  5. mybatis使用map传递多参数报错:A query was run and no Result Maps were found for the Mapped Statement

    在使用mybatis进行多参数传递时,报错: A query was run and no Result Maps were found for the Mapped Statement 'xx.xx ...

  6. ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.win.mall.dao.CartMapper.test’. It’s likely that neither a Result Type nor a Result Map was specified.

    ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.win.m ...

  7. mybatis报错:A query was run and no Result Maps were found for the Mapped Statement、、Property [login_ip] not found on type [com.thinkgem.jeesite.common.permission.entity.PremissUser]问题解决

    今天在做ssm项目的时候出现了: 先是出现 了错误: mybatis报错:A query was run and no Result Maps were found for the Mapped St ...

  8. mybatis报错:A query was run and no Result Maps were found for the Mapped Statement

    转自:https://blog.csdn.net/u013399093/article/details/53087469 今天编辑mybatis的xml文件,出现如下错误: 程序出现异常[A quer ...

  9. mybatis mapper xml文件配置resultmap时,id行和result行有什么区别?

    mybatis mapper xml文件配置resultmap时,id行和result行有什么区别? <resultMap id = "CashInvoiceMap" typ ...

随机推荐

  1. 【11】ajax请求后台接口数据与返回值处理js写法

    $.ajax({ url: "/test.php",//后台提供的接口 type: "post",   //请求方式是post data:{"type ...

  2. 利用Smarty实现文本隔行变色

    行变色 php页面 <?phpinclude "libs/Smarty.class.php";$smarty = new Smarty(); $link = mysql_co ...

  3. Java NIO学习笔记九 NIO与IO对比

    Java NIO与IO Java nio 和io 到底有什么区别,以及什么时候使用nio和io,本文做一个比较. Java NIO和IO之间的主要区别 下表总结了Java NIO和IO之间的主要区别, ...

  4. B站动手学深度学习第十八课:seq2seq(编码器和解码器)和注意力机制

    from mxnet import nd h_forward = nd.array([1,2]) h_backward = nd.array([3,4]) h_bi = nd.concat(h_for ...

  5. NLP基础

    1  自然语言处理三大特征抽取器(CNN/RNN/TF)比较 白衣骑士Transformer:盖世英雄站上舞台 华山论剑:三大特征抽取器比较 综合排名情况 以上介绍内容是从几个不同角度来对RNN/CN ...

  6. ORACLE11G报错汇总

    ============安装类================= 安装Oracle 11g R2的过程中,在新建数据库实例时出现了该错误,如果选择"忽略"就会出现ora-28000 ...

  7. CentOS7.5下,MySQL安装配置指南

    [root@host---- home]# grep 'temporary password' /var/log/mysqld.log --20T02::.457613Z [Note] A tempo ...

  8. web赛题

    @php反序列化漏洞https://www.freebuf.com/news/172507.html @巅峰极客wp https://www.anquanke.com/post/id/189142 @ ...

  9. Java学习笔记-GUI

    Java也提供图像化编程 图形化 GUI(图形用户界面) GUI Graphical User Interface(图形用户接口) 用图形的方式,来显示计算机操作的界面,这样更方便更直观 CLI Co ...

  10. freeRTOS学习8-22

    互斥量的优先级继承机制可以减少优先级翻转问题,通过将持有锁的任务的优先级提升到当前任务中优先级任务最高的任务. #define KEY1_EVENT (0x01 << 0) #define ...