首页 / APACHE / Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result t
Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result t
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result t,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含999字,纯文字阅读大概需要2分钟。
内容图文
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 t全部内容,希望文章能够帮你解决Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result t所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。