File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes update/delete parent and child Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "update/delete parent and child " Watch "update/delete parent and child " New topic

update/delete parent and child

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
i have a parent table: tbl_document, child table: tbl_attachment.

1)Currently when i do delete, it only delete the data from parent table.

2)When i do the update without attaching any attachment, the child will be update with null. but i want the child to actually not to do any update when no attachment is attached (which means it should be retaining its orginial values).
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

This is all related to cascading options you have in your mapping.

Please check out

in the Hibernate Docs.

It explains the different cascade options and how they work.

Good Luck


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
i have managed to solve the delete problem. But i still cant get the update to work.

For the update, the child is not necessary to be update always. How shld i do that?
I agree. Here's the link:
subject: update/delete parent and child
jQuery in Action, 3rd edition