A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
One-to-Many association delete
Joined: Jun 03, 2005
Aug 24, 2009 17:04:11
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?
Joined: Nov 06, 2000
Aug 25, 2009 05:52:45
You can try delete on the child first. So try: session.delete(child)
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: One-to-Many association delete
Deleting OneToMany Entities in EJB3
append an element to a text node using jdom?
Improving An Algorithm
Parent Key Not Found Error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014