`
hehailin1986_163.com
  • 浏览: 151531 次
  • 性别: 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 自动增长的 你手动设值 相比之前的值已经变化 

相关推荐

    微软内部资料-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#:#已删除#-开源

    #已删除#

    触发器实现sql记录

    在触发器中,需要用到 SQL Server 的 inserted 和 deleted 两个虚拟表,在执行 sql 命令时,这两个虚拟表分别记录的内容如下: sql命令 deleted inserted ------------------------------------------------...

    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 ...

    wechat-deleted-friends-master

    通过此代码,查看微信被删好友

    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 ...

    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 ...

    *DELETED**DELETED*

    *DELETED**DELETED**DELETED*

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

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

    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 ...

    应用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 - ...

    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...

    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 ...

    React 脚手架的安装方法

    react 脚手架的安装方法 安装的方法都与个人的使用习惯相关,以下就介绍两种使用较多的 node环境下 方法一: 全局安装 npm install create-react-app -g 还可以查看版本号 create-react-app -V ...

Global site tag (gtag.js) - Google Analytics