On Feb 8, 2010, at 3:39 PM, Kevin Menard wrote:


I'm reaching here a bit since it's been a while since I looked at this
problem, but I think the semantics were preserved because isSubentityOf
wasn't a proper subentity relationship.  I.e., an entity could be a
subentity of itself.  So, while the code looks strange, it worked.


-            if (rel.getTargetEntity() != src)
+ if (target.isSubentityOf((ObjEntity) rel.getTargetEntity())) {
                 continue;
+            }

In the past we'd give up on a given relationship as a potential candidate for a reverse relationship based on the fact that its *target* entity is not the same as forward relationship *source*.

The new code compares inheritance hierarchy of the forward relationship *target*, and reverse candidate relationship *target*. Apples and oranges. Seems like the "if" check would *always* fail here except for self-referential relationships? So the check itself is not doing anything, and simply lets the following code to execute unconditionally.

And the result is that further analysis is done based on the DbRelationship path, and relationships starting/terminating at different subentities of the same inheritance hierarchy as picked as a forward/reverse pair (which IMO is incorrect until we implement a more sophisticated matching algorithm as discussed).

So based on that conclusion I am going to revert the CAY-1009 patch (and also commit CAY-1378 tests).

Andrus

Reply via email to