Error getting generated key or setting result to parameter object.必须执行该语句才能获得结果。

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
简介: Error getting generated key or setting result to parameter object.必须执行该语句才能获得结果。

错误详情:


org.springframework.jdbc.UncategorizedSQLException: Error getting generated key or setting result to parameter object. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 必须执行该语句才能获得结果。

; uncategorized SQLException; SQL state [null]; error code [0]; 必须执行该语句才能获得结果。; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: 必须执行该语句才能获得结果。


问题出现在一个插入语句中 ,之前做的项目数据库中的主键是自动递增的,新项目用的erp的数据库,xml文档都是复制粘贴的,结果一插入GG了,看一下插入语句:


<insert id="insert" useGeneratedKeys="true" keyProperty="id"
  parameterType="com.xxx.xxx.xxx.xdo.T_OrganizationDO">
  insert into t_Organization (
  <include refid="sqlKey" />
  ) values (
  <include refid="sqlValue" />
  )
</insert>

问题出现在了 :useGeneratedKeys=“true”

这个关键字的意思是插入本条记录并将自动递增的id反写到传入的对象参数中,erp中的表id并没有设置自动递增,所以这个地方自然报错,直接干掉就可以咯!


相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS&nbsp;SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/sqlserver
相关文章
|
21天前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
33 0
|
8月前
|
XML 关系型数据库 MySQL
【MySQL异常】ExecutorException: Error getting generated key or setting result to parameter object
【MySQL异常】ExecutorException: Error getting generated key or setting result to parameter object
181 0
|
17天前
|
缓存 Ubuntu Linux
error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
【5月更文挑战第16天】error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
72 0
|
21天前
|
API Android开发
android setTag (int key, Object tag)使用
android setTag (int key, Object tag)使用
10 1
|
7月前
|
NoSQL MongoDB
mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No s
mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No s
165 0
|
7月前
gdalinfo: error while loading shared libraries: libgdal.so.30: cannot open shared object file: No su
gdalinfo: error while loading shared libraries: libgdal.so.30: cannot open shared object file: No su
|
7月前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
168 33
|
8月前
|
人工智能 自然语言处理 JavaScript
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in created hook: “TypeError: Object(...) is not a func
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in created hook: “TypeError: Object(...) is not a func
55 0
error : Class declarations lacks Q_OBJECT macro
error : Class declarations lacks Q_OBJECT macro
|
11月前
error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
199 0