There are 7 cascade options available for Hibernate . I would like to clarify exactly what behavior to expect from each of them. And although the effect is intuitively clear under the name, but not everywhere as clearly as we would like.
I will describe how I understand, and you please correct me where I am wrong, and complete the gaps.
none (default)- no transactions lead to not creating, not updating, not deleting child objects.save- when creating a new object, children are also created if there are none. And in other cases, the optionnone.update- when an object is updated, the children are updated only if they exist and there are changes in them. And in other cases, the optionnone.save-update- 2 + 3 points.delete- deleting deletes all children.all- 4 + 5 points.all-delete-orphan- it’s not at all clear what he is doing.