Outer join syntax causes exception with Expression.filterObjects()
------------------------------------------------------------------
Key: CAY-1177
URL: https://issues.apache.org/cayenne/browse/CAY-1177
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 3.0M5
Reporter: Øyvind Harboe
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.