java - s2sh购物网站的版本控制version,遇到update就出错

 东东84321 发布于 2022-10-29 08:58

我用s2sh做购物网站,里面用到了版本控制version,save和delete没有问题,但update就显示出错。
我一运行就点update,所以不存在已有一个线程在。
我觉得是这个问题,不知对不对。

以下是错误代码:
org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException: Object of class [com.fangyun.entity.Product] with identifier [0]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.fangyun.entity.Product#0]

org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.fangyun.entity.Product#0]

1 个回答
  • 更新的主键为0,没有对应数据,你更新前打印下数据看看就知道了!

    2022-10-30 11:29 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有