This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 17271

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 - Two Laptop Bag - Tube Organizer
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: update/delete parent and child
It's not a secret anymore!