Should I use NHibernate collection cascading?

Should I use NHibernate collection cascading to perform collection updates, or should I use repositories to save collection objects?

+3
source share
2 answers

As a rule, it makes no sense to include a cascade in the associations "lt; many-to-one" or "to-many-to-many". The cascade is often useful for one-to-one and one-to-many associations.

If the lifetime of the child is limited by the life of the parent, make it a lifecycle object by specifying cascade = "all-delete-orphan".

. , , , cascade = "persist, merge, save-update".

+1
0

Source: https://habr.com/ru/post/1735043/


All Articles