• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ObjectDeletedException and cascade delete problem

 
jan dressen
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

in Hibernate:

Suppose I have an object Parent with a collection of ChildObjects and my mapping wil cascade delete all objects in the ChildObjects collection.
But I still have a reference to one object in my ChildObjects collection, and that one object is also updated. Now when is save my changes to the database I get an ObjectDeletedException because the cascade delete will try to remove the ChildObject, but later on it will re-save it...

do you understand my problem?
can anyone help me find the solution?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, don't update your child object after you have removed it from the Parent. ;)

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic