今天遇到一个问题,原来是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. an extra named object property

    Grunt supports the ability to split each task configuration into several separate configurations all ...

  2. IDEA快捷键(修改成eclipse版)+Templates

    快捷键:使用快捷键需要下载改建的配置文件,默认eclipse版的按键还是不全的. 链接:https://pan.baidu.com/s/17H4tFh__k6rExGpAf8NRJg 密码:rnl3 ...

  3. [CDH] Process data: integrate Spark with Spring Boot

    c 一.Spark 统计计算 简单统计后写入Redis. /** * 订单统计和乘车人数统计 */ object OrderStreamingProcessor { def main(args: Ar ...

  4. springmvc xml文件配置中使用系统环境变量

    来源:how to read System environment variable in Spring applicationContext 答案: In order to access syste ...

  5. Mac运行React Native安卓项目报错解决

    传送门参考: 下面的这个链接很详细了,一步一步就好.... https://github.com/NARUTOyuyang/React-Native 然而在运行react-native run-and ...

  6. vue中 key 值的作用

    原文地址 我们知道,vue和react都实现了一套虚拟DOM,使我们可以不直接操作DOM元素,只操作数据便可以重新渲染页面.而隐藏在背后的原理便是其高效的Diff算法. vue和react的虚拟DOM ...

  7. VMware workstation安装Windows Server 2012 R2步骤详解(附下载链接)

    话不多说,直接上链接.所需工具: 1.VMware workstation 14.0(版本无所谓)                   附链接:https://pan.baidu.com/s/1CrH ...

  8. LeetCode.1184-公交车站之间的距离(Distance Between Bus Stops)

    这是小川的第次更新,第篇原创 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第265题(顺位题号是1184).公交车有n个从0到n-1的车站,形成一个圆圈.我们知道所有相邻车站对之间的 ...

  9. 整合AD RMS与EX 2010。

    1.点击开始菜单, 选择所有程 序,展开 Mi cros oft  Excha nge  Server  2010 ,打开Excha nge Ma na gement Cons ol e,选择收件人配 ...

  10. Linux核心系统命令

    关机,重启: shutdown -h now:关机 shutdown -r now:重启 文件和目录操作命令: pwd:显示当前所在路径 cd:切换目录 cd - :切换到上一次所在路径 cd ~:切 ...