This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

Difference between delete and orphan-delete

 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
In hibernate we have two options for deleting the child. delete and delete-orphan. eg: the below code



What is the difference between the two.

Regards,
Pradeep
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quoted from the Reference:
A special cascade style, delete-orphan, applies only to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed from the association.



 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
But in <one-to-many> tag there is no cascade attribute. . Is it in the <set> tag we need to mention the cascading behavior for the collection(Set) for <one-to-many> relationship?

Eg:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic