• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between delete and orphan-delete  RSS feed

 
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
Posts: 4001
42
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
Boost this thread!