NHibernate single snapshot delete

I am trying to clear the collection in parent / child relation by clearing the collection (list.clear ()) or creating a new collection instance for the parent.

Similar to this: http://markmail.org/message/mnvooa7g57dlbxta#query:+page:1+mid:mnvooa7g57dlbxta+state:results

My test is pretty much identical to the ones listed in the link above. I tried several combinations of settings, but for life I can not get NHibernate to release one single sql delete for all children, and not sql-delete for each child. Something is missing for me.

+4
source share
2 answers

Interesting post. Have you tracked the ayendes issue in NHibernate Jira ?. I tried, and Sergey Koscheev noted that this is โ€œnot a problemโ€ due to the inverse = true match, which somehow prevents the removal of one shot from the work, which means that the reverse display prevents the correct removal of an orphan, leading to orphans seem too self-confident. (not sure if this is the correct adjective)

Try unidirectional matching (if possible) from the parent instead, to make the children more dependent and (hopefully) working remotely with a single shot.

+2
source

Deleting a single snapshot can lead to unforeseen side effects, so I think NHibernate plays it safely and only removes children who are removed from this collection. Of course, you can always use hql to write your own deletion.

0
source

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


All Articles