`
hehailin1986_163.com
  • 浏览: 153684 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Row was updated or deleted by another transaction (or unsaved-value mapping was

    博客分类:
  • Java
阅读更多

最近在一个项目中用到Hibernate, 用的数据库是mysql。
在一个对象表中用到了字段"version", `version` int(11) DEFAULT NULL。 在对一条数据进行插入时手动设置了version的值, 没有问题。但是在对条数据进行更新操作时却报错了:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect):
网上搜了一下,原来是在进行更新时是不能对这个"version"字段手动设置值的。我也试验了一下,果真如此,在不给version设值的时候,每次更新时都会进行自动对这个值加1,而不需要手动设置。其实不是很明白为什么会这样,在这里暂且记录一下,有时间在研究。
分享到:
评论
1 楼 zyq070 2012-09-06  
version 自动增长的 你手动设值 相比之前的值已经变化 

相关推荐

    hibernate错误汇总

    错误十:Exception in thread "main" org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) 错误原因:这个异常通常发生在并发...

    wechat-deleted-friends-master

    《微信好友恢复:深入解析“wechat-deleted-friends-master”项目》 在我们的日常生活中,微信作为一款全球广泛使用的社交应用,已经成为了我们联系亲朋好友、进行商务沟通的重要工具。然而,有时由于误操作或者...

    微软内部资料-SQL性能优化3

    In our example, if one transaction (T1) holds an exclusive lock at the table level, and another transaction (T2) holds an exclusive lock at the row level, each of the transactions believe they have ...

    #DELETED#:#已删除#-开源

    【开源软件】是一种重要的软件开发模式,它遵循开放源代码的原则,允许用户自由地使用、修改、复制和分发源代码。开源软件的兴起源于20世纪80年代末,随着互联网的发展,开源软件的理念逐渐普及,如今已经成为全球...

    acpi控制笔记本风扇转速

    condition was removed by modifying AcpiWalkNamespace to (by default) ignore all temporary namespace entries created during any concurrent control method execution. An additional namespace race ...

    ImpREC 1.7c

    - Updated/corrected plugins and deleted dups v1.6 FINAL (PUBLIC VERSION) --------------------------- - Misc - Finally fixed the bug in the check for adding section (Thanks to Christoph) v1.6 ...

    EF(EntityFramework) 插入或更新数据报错的解决方法

    Entities may have been modified or deleted since entities were loaded. See ...

    Laravel开发-laravel-transaction-observer

    在Laravel中,观察者常用于监听模型事件,如`created`, `updated`, `deleted`等。你可以创建一个观察者类,然后定义要监听的事件方法。以下是一个简单的观察者例子: ```php class UserObserver { public function...

    MySQL 8.0.13设置日期为0000-00-00 00:00:00时出现的问题解决

    刚开始学习数据库操作,今天存数据时发现,保存的时候报错(Error 1292: Incorrect datetime value: '0000-00-00' for column 'deleted_at' at row 1) ,之后就搜索了下原因,是因为MySQL存日期时不允许出现这种格式...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The value of some string flex-properties that began with a parenthese or curly bracket had no apostrophe at the end; that caused an error when reading. (fixed TPropList.SavePropValue for the ...

    project-lvl2-s269:我的应用“差异计算器”

    Property 'common.setting2' was deleted Property 'common.setting3' was updated. From 'true' to complex value Property 'common.setting6.ops' was added with value: 'vops' Property 'common.setting4' was ...

    文件恢复工具

    Empowered by the new unique data recovery technologies, it is the most comprehensive data recovery solution for recovery files from FAT12/16/32, NTFS, NTFS5 (created or updated by Windows 2000/XP/...

    S7A驱动720版本

    - The driver could crash when the driver was stopped (either by hand or when the demo time was expired) and in the same moment the NetLink connection was disturbed. - Improvements on the seamless ...

    eac3to V3.17

    * Blu-Ray subtitle demuxing: PTS value is now written to both PTS + DTS * joining MKV files is now declined with a proper error message * last chapter is now removed, if it's less than 10 seconds from...

    应用Dephi 开发佳能照相机API

    This function delete all the reference or list objects that user has forgotten to delete. Parameters: In: None Out: None Returns: Returns EDS_ERR_OK if successful. In other cases, see ...

    SQLite-Deleted-Records-Parser, 在SQLite数据库中,用于恢复已经删除项目的脚本.zip

    SQLite-Deleted-Records-Parser, 在SQLite数据库中,用于恢复已经删除项目的脚本 SQLite解析器在SQLite数据库中恢复删除条目并将输出放入TSV文件或者文本文件( R ) 中的脚本sqlparse.py的###Usagesqlparse.py -f/...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part2

    Q521783 - Ribbon Form - An AV occurs when restoring a minimized form whose non-client area is painted by the Ribbon if the form was minimized while displaying a hint for its window button Q526309 - ...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part1

    Q521783 - Ribbon Form - An AV occurs when restoring a minimized form whose non-client area is painted by the Ribbon if the form was minimized while displaying a hint for its window button Q526309 - ...

    psp学习资料

    The example was updated to a 25 week schedule which assumes that the same planned value is earned each week. • Changed the exercises in lecture 7 Software Design. The new exercises have the class...

    Android代码-android-architecture-components

    Samples may not be fully featured, documented or tested and could be modified or deleted in the future. BasicSample - Shows how to persist data using a SQLite database and Room. Also uses ViewModels ...

Global site tag (gtag.js) - Google Analytics