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开发者_JAVA技巧 through mappings alone.
FYI, I'm using Fluent NHibernate 1.0RTM and NHibernate 2.1
I figured it out... mappings were incorrect.
They should be this:
// QualificationType
HasMany(x => x.QualificationGroups)
    .Inverse()
    .KeyColumn("QualificationTypeId")
    .AsBag()
    .Cascade.AllDeleteOrphan()
    .Access.CamelCaseField(Prefix.Underscore);
// Qualification Group
HasMany(x => x.Qualifications)
    .Inverse()
    .KeyColumn("QualificationGroupId")
    .AsBag()
    .Cascade.AllDeleteOrphan()
    .Access.CamelCaseField(Prefix.Underscore);
I had the wrong key column in each.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论