源代码片段:

 <insert id="addAdminAction" parameterType="x.x.x.RoleVo">
<selectKey keyProperty="idRole, createdDate" resultType="x.x.x.RoleVo" order="BEFORE">
select getid() idRole, to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') createdDate from dual
</selectKey>
<!-- insert sql-->
</insert>

报错内容:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ' createdDate' in 'class x.x.x.RoleVo'

原因:当keyProperty有多个目标列时,列关键字之间用逗号","分隔,并且不应有多余空格(即keyProperty="idRole, createdDate"间不应该有空格)。

正确代码片段:

 <insert id="addAdminAction" parameterType="x.x.x.RoleVo">
<selectKey keyProperty="idRole,createdDate" resultType="x.x.x.RoleVo" order="BEFORE">
select getid() idRole, to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') createdDate from dual
</selectKey>
<!-- insert sql-->
</insert>

一个空格引起的错误,个人觉得还是挺有意思的

Mybatis selectKey标签的keyProperty属性报错,关键字间隔不能有空格的更多相关文章

  1. 打开sa属性报错

    --如果打开sa属性报错如下:无法显示请求的对话框.属性IsLocked不可用于“登录名sa".该对象可能没有此属性,也可能是访问权限不足而无法检索 --解决办法:首先用windows登录, ...

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

  3. Mybatis 未设置主键映射报错;Cause: java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'

    使用MyBatis的时候,主键的字段建议绑定在Bean的属性上面, import javax.persistence.*; public class User { @Id @Column(name = ...

  4. Mycat分布式数据库架构解决方案--配置defaultAccount属性报错解决方案

    echo编辑整理,欢迎转载,转载请声明文章来源.欢迎添加echo微信(微信号:t2421499075)交流学习. 百战不败,依不自称常胜,百败不颓,依能奋力前行.--这才是真正的堪称强大!!! 该文章 ...

  5. 解决使用mybatis分页插件PageHelper的一个报错问题

    在项目中使用PageHelper进行分页,启动运行时报错,报错如下: 27-Aug-2017 09:58:48.017 INFO [localhost-startStop-1] org.apache. ...

  6. ie8下修改input的type属性报错

    摘要: 现在有一个需求如图所示,当用户勾选显示明文复选框时,要以明文显示用户输入的密码,去掉勾选时要变回密文,刚开始想到的就是修改输入框的type来决定显示明文还是密文,使用jQuery的attr来做 ...

  7. 移动端,点击a标签链接的pdf报错 Resource interpreted as Document but transferred with MIME type application/pdf

    源码: <a href="11.pdf" class="actcont_a fl report_a" style="display: block ...

  8. hibernate和mybatis出现配置文件xml的文件报错Multiple annotations found at this line(转)

    hibernate中的xml配置文件Multiple annotations found at this line,出现这个红叉报错,直接是把 <?xml version="1.0&q ...

  9. 无法访问mybatis.dto.StudengInVO-使用maven编译报错-2022新项目

    一.问题由来 最近一次拉代码后,合并代码然后进行编译时出现一个问题,使用maven在进行编译的时候报一个错,无法访问mybatis.dto.StudengInVO. 突然出现这个错误让自己感觉很奇怪, ...

随机推荐

  1. 用 Python 和 OpenCV 检测图片上的条形码(转载)

    原文地址:http://python.jobbole.com/80448/ 假设我们要检测下图中的条形码: # load the image and convert it to grayscale 1 ...

  2. [BZOJ3237]连通图

    Description Input Output Sample Input 4 5 1 2 2 3 3 4 4 1 2 4 3 1 5 2 2 3 2 1 2 Sample Output Connec ...

  3. LA 6891 Money Transfers(最短路)

    https://vjudge.net/problem/UVALive-6891 题意: 给定一个加权无向图,还有起点和终点,现在有个SWERC公司,拥有图中的m个顶点,现在可以使图中的每一条边都加上k ...

  4. 安全之路:Web渗透技术及实战案例解析(第2版)

    安全之路:Web渗透技术及实战案例解析(第2版)

  5. pybedtools --bedtools的python包

    http://daler.github.io/pybedtools/ 用个下面这个 >>> fn = pybedtools.example_filename('test.fa') & ...

  6. BZOJ 3930 【CQOI2015】 选数

    题目链接:选数 这种SB题我都Wa飞了,彻底没救系列- 首先,我们可以发现1,如果我们选了两个不同的数,那么它们的\(\gcd\)不会超过\(r-l+1\).于是,我们可以设一个\(f_i\)表示任取 ...

  7. C++中的动态绑定

    C++中基类和派生类遵循类型兼容原则:即可用派生类的对象去初始化基类的对象,可用派生类的对象去初始化基类的引用,可用派生类对象的地址去初始化基类对象指针. C++中动态绑定条件发生需要满足2个条件: ...

  8. display:box,按比列划分,水平均分,及垂直等高

    一.按比例划分 <div class="test"> <p id="p1">Hello</p> <p id=" ...

  9. 快递100API接口调用代码示例

    package com.util; import java.io.IOException; import java.io.InputStream; import java.net.MalformedU ...

  10. Java中代码点与代码单元(转)

    摘要 本文介绍 Java 平台支持增补字符的方式.增补字符是 Unicode 标准中代码点超出 U+FFFF 的字符,因此它们无法在 Java 编程语言中描述为单个的 16 位实体(例如char数据类 ...