Andrus Adamchik created CAY-2878:
------------------------------------

             Summary: PK-to-PK optional 1..1 relationships should be resolved 
from the snapshot cache
                 Key: CAY-2878
                 URL: https://issues.apache.org/jira/browse/CAY-2878
             Project: Cayenne
          Issue Type: Improvement
            Reporter: Andrus Adamchik


DataDomainQueryAction.interceptRelationshipQuery(..)  has a check:

{noformat}
if (relationship.isSourceIndependentFromTargetChange()) {
    return !DONE;
}
{noformat}

Which is reasonable for to-many relationships. But for PK-to-PK optional 1..1, 
it misses the opportunity to find the target object in the shared snapshot 
cache. We need to be smarter. Cache will not help us to determine whether the 
target object is NULL, but a presence of a target object would save us a DB 
trip. The logic should be something like this:
```
if (relationship.isSourceIndependentFromTargetChange()) {

        if(/* can guess target ObjectId */) {
                /* check for snapshot in the cache */
                /* if found, return */
                /* if not found, return !DONE*/
        }

    return !DONE;
}
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to