I have a hierarchy of tables 3 levels deep (QualificaionType has many QualificationGroups, which have many Qualifications) mapped like this:
// QualificationType
HasMany(x => x.QualificationGroups)
.Inverse()
.KeyColumns.Add("QualificationGroupId")
.AsBag()
.Cascade.AllDeleteOrphan()
.Access.CamelCaseField(Prefix.Underscore);
// Qualification Group
HasMany(x => x.Qualifications)
.Inverse()
.KeyColumns.Add("QualificationId")
.AsBag()
.Cascade.AllDeleteOrphan()
.Access.CamelCaseField(Prefix.Underscore);
When I delete a Qualification Group, it deletes all qualifications related to it. But when I try to delete a Qualification Type, it tries to delete all related Qualification Groups but not their Qualifications.
How can I get it to cascade all the way down so that if I delete a Type, it deletes all the Groups and all of their Qualifications? Do I need to loop through all the Groups first and delete them? It seems this should be able to be handled through mappings alone.
FYI, I'm using Fluent NHibernate 1.0RTM and NHibernate 2.1