cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAY-1177) Outer join syntax causes exception with Expression.filterObjects()
Date Wed, 15 Jul 2009 11:49:15 GMT

    [ https://issues.apache.org/jira/browse/CAY-1177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12731405#action_12731405
] 

Andrus Adamchik commented on CAY-1177:
--------------------------------------

Sorry, had this in my queue for some time. Hopefully will review and commit soon.

> Outer join syntax causes exception with Expression.filterObjects()
> ------------------------------------------------------------------
>
>                 Key: CAY-1177
>                 URL: https://issues.apache.org/jira/browse/CAY-1177
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M5
>            Reporter: √ėyvind Harboe
>         Attachments: FilterObjects.txt, FilterObjects_1.1.txt, FilterObjects_1.txt
>
>
> If the "+." syntax is used in an Expression.filterObjects() it causes an exception. Below
is a modification to CayenneDataObject.readNestedProperty() that seems to work around the
problem. 
> Simply replace "+." with "."
>     public Object readNestedProperty(String path) {
>         Object object = null;
>         CayenneDataObject dataObject = this;
>         
>         /* convert +. outer join syntax into . */
>         if (path.contains("+."))
>         {
>         	path=path.replaceAll("\\+\\.", ".");
>         }
>         
>         String[] tokenized = tokenizePath(path);
>         int length = tokenized.length;
>         int pathIndex = 0;
>         for (int i = 0; i < length; i++) {
>             pathIndex += tokenized[i].length() + 1;
>             object = dataObject.readSimpleProperty(tokenized[i]);
>             if (object == null) {
>                 return null;
>             }
>             else if (object instanceof CayenneDataObject) {
>                 dataObject = (CayenneDataObject) object;
>             }
>             else if (i + 1 < length) {
>                 // read the rest of the path via introspection
>                 return PropertyUtils.getProperty(object, path.substring(pathIndex));
>             }
>         }
>         return object;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message