`

hibernate 删除异常: deleted object would be re-saved by cascade (remove deleted obje

阅读更多
今天在做数据同步的时候遇到这个异常:在google上面查找了下 发现原来我在处理实体类来多对一上面的问题
我在删除实体的时候因为有很多外键关联,所以必须先删除实体中的Set,因为存在很多关联,我直接用反射来查找所有返回为Set类型的方法。然后获取值,用hibernate来删除
结果就报了标题上的错误
其实我少了一个步骤就是在那删除前应该remove掉
   .....
   Set set = (Set)method.invoke(pbasic,null);
   for(Object object:set){
      set.remove(object);
      commoDao.delete(object);
   }
分享到:
评论

相关推荐

    EurekaLog_7.5.0.0_Enterprise

    30)..Fixed: Leak of EurekaLog exception information object 31)..Fixed: Wrong chaining exceptions inside GetMem/FreeMem 32)..Fixed: Memory leak after low-level unhook of function 33)..Fixed: Re-...

    android扫雷源码

    安卓 扫雷源码 添加重新开始按钮支持 Android studio =========================...(This import summary is for your information only, and can be deleted after import once you are satisfied with the results.)

    触发器实现sql记录

    在许多应用中,需要保存某个数据表的历史记录,以供以后查询,在 SQL Server 2000 中,可以利用触发器轻松实现历史记录功能。... delete 被删除的记录 [不可用] ---------------------------------------------------

    delphi编译错误.txt

    FOR or WHILE loop executes zero times - deleted FOR或WHILE循环执行零次-删除 FOR-Loop variable ''''<name>'''' cannot be passed as var parameter FOR循环变量不能作为参数传递 FOR-Loop variable ''''<Name>'...

    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存日期时不允许出现这种格式...

    sql触发器实例详细讲解

    定义: 何为触发器?在SQL Server里面也就是对某一个表的一定的操作,触发某种条件,从而... 一个Update 的过程可以看作为:生成新的记录到Inserted表,复制旧的记录到Deleted表,然后删除Student记录并写入新纪录。

    Exploring the location of object deleted by seam-carving

    Exploring the location of object deleted by seam-carving

    React 脚手架的安装方法

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

    edjpgcom|图片中插入一句话

    should still have your original file (unless you deleted it!). You might have to clean up a .nnn file but that's it. It's been tested on Win2k, NT 4.0 SP5, Win95a, Win98, and Win98SE. Limitations:...

    Zteam原始代码

    1> Deleted SEASON5DOT2_JPN, all changes undefined 1> Changed XOR32 keys 1> More test changes in DSProtocol, user and etc 1> [JewelMixSystem.cpp] Fixed item delete in ::MixJewel 1> [JewelMixSystem.cpp]...

    RemoveSymantecMacFiles.command

    that would be deleted. No note is added if a file is not supposed to be removed by Symantec Uninstaller. -f Do not show files as they are removed. If -f is not specified, file names are shown as ...

    谷歌地图 delphi 封装库 2013 0.1.9 全面支持google maps api

    - Improvement: TLinkedComponent => added FObject (TObject) property. - Improvement: TLinkedComponent => added protected methods (SetProperty) to generalize change into properties to avoid duplicate ...

    alfresco-deleted-content-store-cleaner:Alfresco删除的Content Store Cleaner作业

    Alfresco删除的内容商店清洁程序 该加载项提供了一项工作,以删除“已删除的内容存储”中的废弃文件。 从Alfresco 5.2(201707 GA)开始,已提供开箱即用的Trashcan Cleaner作业,尽管默认情况下是禁用的。 这项...

    应用Dephi 开发佳能照相机API

    {****************************************************************************** * * ... Gets an indexed child object of the designated object. Parameters: In: inRef - The reference...

    tg-notify-deleted-messages:电报客户端以保存并通知已删除的消息

    tg-notify-deleted-messages允许您跟踪被对话者删除的消息。 删除后,它们将与有关发件人的元数据一起存储在“已保存的消息”中。 它还支持附件,而无需将其存储在磁盘上。 组态 前往 。 选择“ API开发工具”并...

    修复Linux异常自动重启问题

    这几天训网络最困扰我的问题就是服务器...EXT4-fs error (device sda1): ext4_lookup:1593: inode #6004222: comm trash-expunge: deleted inode referenced: 6004301 类似这样的错误,看样子是sda1磁盘文件系统的问题

    danbooru-recontaminant

    当前,除非指定了status: term,否则在Danbooru上的帖子搜索默认情况下会排除已删除的帖子。 Recontaminant是一种应用了相反行为的网络扩展,因此默认情况下会包含已删除的帖子。 只要在表达式中不存在其他任何...

    sgcWebSockets_source_4.1.0

    [+] : New Property "NotifyDeletes" in Dataset Server Protocol, if enabled (by default) broadcast deleted record to all clients. [+] : New Method "BroadcastRecord" in Dataset Server Protocol, sends ...

    Redis集群管理工具redis-cluster-tool.zip

    redis-cluster-tool 是一个非常便利的 Redis 集群管理工具。help   Usage: redis-cluster-tool [-?hVds] [-v verbosity level]... delete keys job finished, deleted: 999999 keys, used: 4 s 标签:redis

    sgcWebSockets 4.1.0.Full.Source稳定版

    [+] : New Property "NotifyDeletes" in Dataset Server Protocol, if enabled (by default) broadcast deleted record to all clients. [+] : New Method "BroadcastRecord" in Dataset Server Protocol, sends ...

Global site tag (gtag.js) - Google Analytics