You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dzmitry Kazimirchyk (JIRA)" <ji...@apache.org> on 2011/08/16 13:04:27 UTC

[jira] [Created] (CAY-1600) Multiple ObjRelationships mapped to one DbRelationship are not handled correctly

Multiple ObjRelationships mapped to one DbRelationship are not handled correctly
--------------------------------------------------------------------------------

                 Key: CAY-1600
                 URL: https://issues.apache.org/jira/browse/CAY-1600
             Project: Cayenne
          Issue Type: Bug
          Components: Core Library
    Affects Versions: 3.1M2
            Reporter: Dzmitry Kazimirchyk
            Priority: Minor


Cayenne doesn't correctly handle multiple ObjRelationships which are mapped to the same DbRelationship and have same source entities.
There is couple of examples describing typical issues with this:

  * We have two ObjEntities SourceEntity and TargetEntity with one DbRelationship between them and two ObjRelationships (SourceEntity->TargetEntity: toTargetByList and toTargetByMap), and reversed DbRelationship with one ObjRelationship (TargetEntity->SourceEntity: toSource). Now when we update toTargetByList then toTargetByMap is not updated and vice versa. And on the other side when we update toSource relationship, which actually has two reversed relationships, then only one of them (toTargetByList or toTargetByMap) will be updated.

  * Another one is with inheritance. It occurs when we use ObjRelationship of super entity as reversed for some relationship to sub entity. For example, we have SuperEntity, SubEntity and TargetEntity which have SuperEntity->TargetEntity and TargetEntity->SubEntity relationships. On initialization Cayenne processes SuperEntity separately from SubEntity and since it has no reversed relationship for SuperEntity->TargetEntity Cayenne creates one (runtime relationship TargetEntity->SuperEntity) for consistency, and after that we actually have two ObjRelationships to SubEntity (TargetEntity->SubEntity and inherited runtime relationship TargetEntity->SuperEntity) with all the consequences.

Maybe putting this together is too general, but the problem definitely is in how Cayenne should deal with such "duplicate" relationships (should we restrict them or handle in a special way). For now, I suppose, we must show warning in the modeler.
This issue comes to put together all separated info about such problems from CAY-1008, CAY-1009, CAY-1520, etc.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira