Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2779

"Nullify" delete rules is not processed with n:m and inheritance hierarchy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.2.RC1
    • 5.0-M2
    • None
    • None

    Description

      A model the same as the one in CAY-2777:

      
      // a table with a many to many to self
      T1: id, type
      T11: child_id, parent_id; 
      
      // Base ObjEntity
      O1: 
        - flat rel "parents" mapped as "db:parents.parent"
      
      // Sub ObjEntity 1
      O1S1:
        - flat rel "children" mapped as "db:children.child"
      
      // Sub ObjEntity 2
      O1S2:
      

      n:m has "Nullify" delete rule on both ends. When deleting a child, the child is not removed from parent's children, because the code gets confused about the inheritance hierarchy. Specifically here inside ObjectContextDeleteAction, "reverseArc" is null, whereas it should be "O1S1.children" :

      case DeleteRule.NULLIFY:
          ArcProperty reverseArc = property.getComplimentaryReverseArc();
      
          if (reverseArc == null) {
              // nothing we can do here
              break;
          }
      

      Oddly enough, it still generated a correct DB operation, deleting the join table record, because of the hardcoded flattened relationship processing block just a few lines prior the one mentioned above.

      These two things are still incorrect:

      • Parent object still has a child in its collection
      • "nodeRemoved" graph operation is not recorded, so any listener flows that depend on it do not work.

      Attachments

        Activity

          People

            ntimofeev Nikita Timofeev
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: