<< SQL 技巧-Oracle与MS SQL Server的不同 | 首页 | A developer's guide to EJB transaction management >>

ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)解决方法

org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)解决方法:

1. To delete a Parent:
a. Make sure your Parent is not associated to any parent.
b. Delete the Parent and all connected Child will be too.


2. To delete a Child:
a. Remove the Child from the Sets from all Parentes asigned to.
b. Save the Parent which had the Child and the Child will be vanished too. (There is no need to delete it explicit.)

3. 删除Set方的cascade
4. 解决关联关系后,再删除 :

parent.getChildrens().remove(child);
child.setParent(null);
dao.removeChild(child);
5. 在many-to-one方增加cascade 但值不能是none

标签 :


Re: ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)解决方法

好像不能,还是报同样的错误

发表评论 发送引用通报