I’m trying to clear a collection in a parent/child relationship by either clearing the collection (list.clear()) or creating a new instance of the collection on 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 one in the link above. I’ve tried several combination’s of settings but for the life of me I cannot get NHibernate to issues a single sql delete for all of the children as opposed to a sql delete for each child object. I must be missing something.
Interesting post. Have you tracked ayendes problem within NHibernate Jira?. I tried to and Sergey Koshcheyev marked it as ‘not an issue’ because of the inverse=true mapping that somehow seems to prohibit one shot delete from working, which means to me the inverse mapping prohibits the delete-orphan from working properly cause the orphans seem to be too self-contained by this. (not sure that this is the right adjective)
Try unidirectional mapping (if possible) from the parent instead to make the childs more dependent and (hopefully) one-shot deletion work.