Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

update/delete parent and child

 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic