• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deleted object would be re-saved by cascade when deleting a shared child object

 
neriyan nadasen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am getting the infamous "deleted object would be re-saved by cascade error" with Hibernate and I need some help to resolve it.

The entity model is as follows: There is a Person, Team and TeamMemberships between them. A Person can belong to many Teams and a Team can have many Persons linking to it, via TeamMembership objects.

Team


Person


TeamMembership


So basically the TeamMembership is the "child" of both Person and Team. Everything works correctly when I edit team memberships from the team side. However when I try to edit team memberships from the person side I get this error. Is the some mapping annotation of mine that is incorrect or that I am missing out? Any other solutions would be much appreciated.
 
Balaji Vankadaru
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to change Cascade all at the first step at child class.

 
neriyan nadasen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Balaji: Thanks for the response. What must I change it to?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic