使用mybatis时出现异常问题:

有如下的错误

 Error querying database.  Cause: org.apache.ibatis.executor.ExecutorException: 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最常见的一种错误,从其描述来看是user.insertUser!selectKey这个Statement没有Result Type或Result Map。下面是我的配置文件的statement:

 <insert id="insertUser" parameterType="com.luchao.mybatis.first.po.User">
<selectKey keyProperty="id" order="AFTER" >
select LAST_INSERT_ID()
</selectKey>
insert into user(username,birthday,sex,address) value (#{username},#{birthday},#{sex},#{address});
</insert>

可以看出主要是<selectKey>没有resultType所致的。

mybatis中不管什么查询,都必须返回resultType或者resultMap的值,否则就会报错的。

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.的更多相关文章

  1. 出错: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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

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

    今天遇到一个问题,原来是mapper.xml文件出了问题,是使用MyBatis最常见的一种错误 报错的结果是这样的: A query was run and no Result Maps were f ...

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

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

  9. java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.lang.Integer

    今天做springmvc+mybatis+spring的项目的时候发现了一个异常.如下: org.apache.ibatis.builder.IncompleteElementException: C ...

随机推荐

  1. nodejs模块——http模块

    http模块主要用于创建http server服务. 本文还用到url模块和path模块,还有fs模块.url模块用于解析url,path模块用于处理和转换文件路径. 一.简单应用 代码如下: // ...

  2. [转]html5 js 访问 sqlite 数据库的操作类

    本文转自:http://blog.csdn.net/tsxw24/article/details/7613815 webkit 核心的浏览器提供了 3个 api接口,用于访问本地sqlite数据,但使 ...

  3. PCA原理与实践

    在对数据进行预处理时,我们经常会遇到数据的维数非常之大,如果不进行相应的特征处理,那么算法的资源开销会很大,这在很多场景下是我们不能接受的.而对于数据的若干维度之间往往会存在较大的相关性,如果能将数据 ...

  4. 图的全局最小割的Stoer-Wagner算法及例题

    Stoer-Wagner算法基本思想:如果能求出图中某两个顶点之间的最小割,更新答案后合并这两个顶点继续求最小割,到最后就得到答案. 算法步骤: --------------------------- ...

  5. 网格弹簧质点系统模拟(Spring-Mass System by Euler Integration)

    弹簧质点模型是利用牛顿运动定律来模拟物体变形的方法.如下图所示,该模型是一个由m×n个虚拟质点组成的网格,质点之间用无质量的.自然长度不为零的弹簧连接.其连接关系有以下三种: 1.连接质点[i, j] ...

  6. Ajax与jQuery、json

    一.Ajax简介 Ajax(Asynchronous JavaScript and Xml)--异步刷新技术 Ajax的关键元素包括以下内容: ① JavaScript语言:Ajax技术的主要开发语言 ...

  7. History 对象

    History 对象 History 对象包含用户(在浏览器窗口中)访问过的 URL. History 对象是 window 对象的一部分,可通过 window.history 属性对其进行访问. 注 ...

  8. AIO 简介

    from:http://blog.chinaunix.net/uid-11572501-id-2868654.html   Linux的I/O机制经历了一下几个阶段的演进: 1. 同步阻塞I/O: 用 ...

  9. php中的ip2long和long2ip的理解

    IPv4地址是如何表示的 IPv4使用无符号32位地址,因此最多有2的32次方减1(4294967295)个地址.一般的书写法为用4个小数点分开的十进制数,记为:A.B.C.D,比如:157.23.5 ...

  10. js函数命名常用动词

    get 获取/set 设置, add 增加/remove 删除 create 创建/destory 移除 start 启动/stop 停止 open 打开/close 关闭, read 读取/writ ...