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 update/delete parent and child Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply 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: 16622

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.
 
 
subject: update/delete parent and child
 
Threads others viewed
Deleting from multiple Tables
retrieving object hierarchy - many-to-one?
cascade vs inverse
auto insert/update/delete
Association problem in delete
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture