Two Laptop Bag*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "update/delete parent and child " Watch "update/delete parent and child " New topic
Author

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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

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

Please check out

http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#example-parentchild-cascades

in the Hibernate Docs.

It explains the different cascade options and how they work.

Good Luck

Mark


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?
thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update/delete parent and child