File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes One-to-Many association delete Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "One-to-Many association delete" Watch "One-to-Many association delete" New topic
Author

One-to-Many association delete

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
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,
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
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: http://aspose.com/file-tools
 
subject: One-to-Many association delete
 
Similar Threads
Deleting OneToMany Entities in EJB3
Improving An Algorithm
Parent Key Not Found Error
append an element to a text node using jdom?
Mapping Question