Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性
mybatis插入数据时报错:
Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
原因:加了如下标红的设置(useGeneratedKeys="true"把新增加的主键赋值到自己定义的keyProperty(id)中)
<insert id="insert" parameterType="com.vimtech.bms.business.domain.monitor.finan.AssetsVisitReportWithBLOBs" useGeneratedKeys="true" keyProperty="serialid">
解决方法一:没什么用的话,删除标红的即可;
解决方法二:用selectKey先查下自增的主键ID值然后赋给相应的主键ID即可
oracle的写法(查序列的下一个值然后赋值):
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="###">
SELECT SEQ_ASSETS_VISIT_REPORT.nextval AS ### FROM dual
</selectKey>
SQLServer的写法
<selectKey resultType="java.lang.Integer" keyProperty="timelineConfigId">
SELECT @@IDENTITY AS TIMELINE_CONFIG_ID
</selectKey>
Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性的更多相关文章
- 出错: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 ...
- SpringBoot报错:nested exception is org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk.test.User matching [java.lang.Long, java.lang.String, java.lang.String]
错误提示: Caused by: org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk._16 ...
- Mybatis报错Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.
SqlSession被关闭了,检查是否使用了被关闭的SqlSession.
- mybatis插入出现org.apache.ibatis.executor.ExecutorException: No setter found for the keyProperty 'xxx'异常的原因
确定有setter方法,问题其实是xml文件中,insert的主键的列名写错了,如下,一开始写成ComId <insert id="insertCom" parameterT ...
- org.apache.ibatis.executor.ExecutorException: No constructor found in xxxClass matching [java.lang.String, java.lang.Long, java.lang.String, java.lang.String, java.sql.Timestamp]
解决方案 为bean加上默认构造方法 public class User { private String username; private long id; private String sex; ...
- Mybatis出现错误org.apache.ibatis.executor.ExecutorException: No constructor found in
错误显示没有发现构造器. 其实就是重写了构造器后,忘了补写一个默认的空参构造器了.此类的错误还经常出现在spring等这种大量使用反射的框架中.因为这些框架在调用反射的类后会默认调用默认的构造器 解决 ...
- uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111
WHERE 的条件取值时添加上jdbcType=NUMBER这样的配置 参考[1]:https://blog.csdn.net/fyhjuyol/article/details/45483167
- Error getting nested result map values for 'company'. Cause: java.sql.SQLException: Invalid value for getInt() - 'NFHK188'
我今天遇到一个我不解的问题,是mybatis多对一关系查询出问题了,但是我自己还是解决了,在网上也查过那个错误,可是找不到我想要的.不知道你们遇到过没有,我接下来分享给大家.希望我这个第一篇博客能帮助 ...
- mybatis查询异常-Error querying database. Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List
背景,mybatis查询的时候直接取的sqlsession,没有包装成SqlSessionTemplate,没有走spring提供的代理. 然后我写的获取sqlsession的代码没有考虑到并发的情况 ...
随机推荐
- svm+voting
# encoding:utf-8 import getopt from sklearn.preprocessing import MinMaxScaler import os,time from mu ...
- URAL 1932 The Secret of Identifier(容斥)
Description Davy Jones: You've been captain of the Black Pearl for 13 years. That was our agreement. ...
- Java 多态方法构造器执行方法
我们参考下面这个例子: 读者可以提前考虑一下,这段程序的输出会是什么. public class Polymorphism { /** * 创建一个类A * 该类中有一个方法draw,以及一个构造方法 ...
- Internet History,Technology and Security
Internet History,Technology and Security(简单记录) First Week High Stakes Research in Computing,and Comm ...
- 软工实践 - 第二十九次作业 Beta 冲刺(7/7)
队名:起床一起肝活队 组长博客:https://www.cnblogs.com/dawnduck/p/10159251.html 作业博客:[班级博客本次作业的链接] (https://edu.cnb ...
- 面试题中经常遇到的SQL题:删除重复数据,保留其中一条
如题,解决思路如下: 1.首先我们需要找出拥有重复数据的记录 ---以name字段分组 select Name,COUNT(Name) as [count] from Permission group ...
- Dispose的调用顺序
非托管资源的释放顺序. 这是应该先释放 reader 再释放 stream. 或者直接使用using,防止出错 .
- Hadoop执行bin/stop-all.sh时no namenode to stop异常
1 先关闭hadoop所有服务 命令: bin/stop-all.sh 2 格式化namenode 命令: bin/hadoop namenode -format 3 重新启动所有服务 命令: bin ...
- C语言数组作业总结
数组作业总结 评分注意事项. 注意用Markdown语法排版,尤其注意伪代码用代码符号渲染.用符号 ``` 生成代码块. 变量名不规范,没注释,没缩进,括号不对齐,倒扣5分. PTA上写的所有代码务必 ...
- [UOJ #48]【UR #3】核聚变反应强度
题目大意:给你一串数$a_i$,求$sgcd(a_1,a_i)$,$sgcd(x,y)$表示$x,y$的次大公约数,若没有,则为$-1$ 题解:即求最大公约数的最大约数,把$a_1$分解质因数,求出最 ...