Mybatis selectKey标签的keyProperty属性报错,关键字间隔不能有空格
源代码片段:
<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属性报错,关键字间隔不能有空格的更多相关文章
- 打开sa属性报错
--如果打开sa属性报错如下:无法显示请求的对话框.属性IsLocked不可用于“登录名sa".该对象可能没有此属性,也可能是访问权限不足而无法检索 --解决办法:首先用windows登录, ...
- 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 ...
- Mybatis 未设置主键映射报错;Cause: java.sql.SQLSyntaxErrorException: Unknown column 'system_id' in 'field list'
使用MyBatis的时候,主键的字段建议绑定在Bean的属性上面, import javax.persistence.*; public class User { @Id @Column(name = ...
- Mycat分布式数据库架构解决方案--配置defaultAccount属性报错解决方案
echo编辑整理,欢迎转载,转载请声明文章来源.欢迎添加echo微信(微信号:t2421499075)交流学习. 百战不败,依不自称常胜,百败不颓,依能奋力前行.--这才是真正的堪称强大!!! 该文章 ...
- 解决使用mybatis分页插件PageHelper的一个报错问题
在项目中使用PageHelper进行分页,启动运行时报错,报错如下: 27-Aug-2017 09:58:48.017 INFO [localhost-startStop-1] org.apache. ...
- ie8下修改input的type属性报错
摘要: 现在有一个需求如图所示,当用户勾选显示明文复选框时,要以明文显示用户输入的密码,去掉勾选时要变回密文,刚开始想到的就是修改输入框的type来决定显示明文还是密文,使用jQuery的attr来做 ...
- 移动端,点击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 ...
- hibernate和mybatis出现配置文件xml的文件报错Multiple annotations found at this line(转)
hibernate中的xml配置文件Multiple annotations found at this line,出现这个红叉报错,直接是把 <?xml version="1.0&q ...
- 无法访问mybatis.dto.StudengInVO-使用maven编译报错-2022新项目
一.问题由来 最近一次拉代码后,合并代码然后进行编译时出现一个问题,使用maven在进行编译的时候报一个错,无法访问mybatis.dto.StudengInVO. 突然出现这个错误让自己感觉很奇怪, ...
随机推荐
- POJ 2486 Apple Tree(树形dp)
http://poj.org/problem?id=2486 题意: 有n个点,每个点有一个权值,从1出发,走k步,最多能获得多少权值.(每个点只能获得一次) 思路: 从1点开始,往下dfs,对于每个 ...
- Jmeter界面总是有warning提示
要用Jmeter测试服务器性能,发现GUI界面总是有warning提示: WARNING: Could not open/create prefs root node Software\JavaSof ...
- [翻译]将智能指针用于C++的类成员
http://stackoverflow.com/questions/15648844/using-smart-pointers-for-class-members Question: I'm hav ...
- C#中标准Dispose模式的实现(转载)
需要明确一下C#程序(或者说.NET)中的资源.简单的说来,C#中的每一个类型都代表一种资源,而资源又分为两类: 托管资源:由CLR管理分配和释放的资源,即由CLR里new出来的对象: 非托管资源:w ...
- JQuery中width和JS中JS中关于clientWidth offsetWidth scrollWidth 等的含义
JQuery中: width()方法用于获得元素宽度: innerWidth()方法用于获得包括内边界(padding)的元素宽度: outerWidth()方法用于获得包括内边界(padding)和 ...
- node中session的管理
请看这个博客: http://spartan1.iteye.com/blog/1729148 我自己的理解 session俗称会话. 第一次访问服务器的时候由服务器创建,相当于一个cookie(就 ...
- Linux 常用环境搭建
已有环境 python 2.6.6 jdk 1.7 —tomcat— —jenkins— —jq— —Python 2.7— —pip— —PIL— —Android SDK— —yum or apt ...
- VNC Viewer连接Cent OS 时的 复制粘帖 功能
虽然 VNC Viewer 比起 vsphere Client 来, 感觉性能差一点. 但毕竟也是个选择. 找了一下 它的这个 功能. 运行一下 vncconfig & 就可以了. 实测好用. ...
- 网络编程 单机最大tcp连接数
在tcp应用中,server事先在某个固定端口监听,client主动发起连接,经过三路握手后建立tcp连接.那么对单机,其最大并发tcp连接数是多少? 如何标识一个TCP连接 在确定最大连接数之前,先 ...
- Python——列表表达式
https://www.cnblogs.com/xuyuanyuan123/p/6718403.html