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

Reverse relationship is not set with single table inheritance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.2.RC1
    • 4.2.RC2
    • None
    • None

    Description

      Given the model:

      // 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:
      
      O1S1 parent = ...
      O1S2 child = ...
      
      // THE PROBLEM IS HERE
      // This fails to set "parents" relationship of O1S2
      parent.addToChildren(child);
      

      The culprit seems to be "ObjRelationship.getReverseRelationship()", specifically this check here

      for (ObjRelationship relationship : target.getRelationships()) {
      
                  // TODO: this should be replaced with inheritance-aware code. 
                  // "relationship.getTargetEntity()" should be allowed to be a 
                  // super entity of source
                  if (relationship.getTargetEntity() != source) {
                      continue;
                  }
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m