源代码片段:

 <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. java第八天

    p41~p45: 1.区别前缀式与后缀式. public class Test { public static void main(String[] args) { int i = 1; System ...

  2. Python面试题目之字典排序

    按照字典的内的年龄排序 待排序的字典 d1 = [ {'name':'alice', 'age':38}, {'name':'bob', 'age':18}, {'name':'Carl', 'age ...

  3. ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory 【学习笔记】【原创】

    作者:庄泽彬(欢迎转载,请注明作者) 说明:千辛万苦终于在ubuntu18.04上安装好cuda9.1与cudnn7.0.5,但是导入import tensorflow as tf却报了这个错误. 上 ...

  4. 存储结构简明分析——DAS、NAS和SAN

    存储的总体分类     主流存储结构   网络存储结构大致分为三种:直连式存储(DAS:Direct Attached Storage).存储区域网络(SAN:Storage Area Network ...

  5. linux下如何关闭某个tmux窗口

    答:分成两个步骤,如下: 1.列出当前的tmux窗口 jello@jello:~$ tmux ls 1: 1 windows (created Tue Jan 17 09:28:05 2019) [2 ...

  6. asp.net自定义控件之加载层

    知识点:JQuery.Ajax.自定义控件 该文旨在给大家开发自定义控件(结合js)一个思路,一个简单的示例,可能在实际项目中并不会这样做. 先来看看效果: 1.在静态页面里开发好想要的效果 jQue ...

  7. jquery获取服务器控件Label的值

    首先引入js文件:<script type="text/javascript" src="js/jquery-1.8.3.js"></scri ...

  8. C++ 自定义错误类

    #include <iostream> #include <exception> using namespace std; struct MyException : publi ...

  9. UVa 1636 决斗

    https://vjudge.net/problem/UVA-1636 题意: 首先在手枪里随机装了一些子弹,然后抠了一枪,发现没有子弹.你希望下一枪也没有子弹,是应该直接再抠一枪还是随机转一下再抠. ...

  10. mac上将代码上传到github以及github对100M以上文件限制上传的处理(lfs)。

    前言 有时我们会写一些小程序来学习新的知识,但是完事之后过一段时间可能会忘记,最好的办法就是找到原来的代码看一看.现在可以将代码免费托管到一些网站上,其中最著名的非github莫属了, 今天就把这个过 ...