By setting on-delete="cascade on the keys, you are letting the DB handle the cascading Are you generating your schema with N I just reproduced your example and it worked fine with and without that attribute. When removing it, Nbernate does the cascading BTW, using lazy="false" fetch="subselect is not something that you should do by default. If you remove those attributes, leave on-delete="cascade and change cascade to save-update you'll only have two queries to retrieve and delete a Parent.
By setting on-delete="cascade" on the keys, you are letting the DB handle the cascading. Are you generating your schema with N I just reproduced your example and it worked fine with and without that attribute. When removing it, Nbernate does the cascading.
BTW, using lazy="false" fetch="subselect" is not something that you should do by default. If you remove those attributes, leave on-delete="cascade" and change cascade to save-update, you'll only have two queries to retrieve and delete a Parent.
Diego, thank you for the to the point answer. (and explanation) I went with removing the on-delete="cascade", this because I like as much control as possible in code and not in the database. The code posted below is the (working) result.
Parent parent's child Hope this helps people with the same problem!
Yep, it looks much cleaner/standard now. – Diego Mijelshon Mar 8 '10 at 12:42.
What I want to achieve is that when I delete the parent, there would be a cascade delete all the way trough to child's child. But what currently happens is this. After having solved the 'cannot insert null value' error with cascading and inverse I hopes this would now delete everything with this code, but only the parent is being deleted.
Did I miss something in my mapping which is likely to be missed? Any hint in the right direction is more than welcome!
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.