This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

One-to-Many association delete  RSS feed

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a Parent child relationship between two entities. I have cascade = all JPA property between these two entities.

I am doing parent.getChildren().add(child) to add children to the parent class and saving the parent entity which works great.

But, when i do parent.getChildren().remove(child) and save the parent the child record is not removed. What should i do to remove the child?

Thanks,
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try delete on the child first. So try: session.delete(child)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!