This looks to be a trivial fix. I changed in readNestedProperty:
pathIndex += tokenized[i].length();
to:
pathIndex += tokenized[i].length() + 1;
and it appears to be working now. I can't check the code in yet, but can
try from home in the next day or two.
Thanks,
/dev/mrg
On 4/25/07, Michael Gentry (JIRA) <[email protected]> wrote:
Bug in CayenneDataObject.readNestedProperty
-------------------------------------------
Key: CAY-781
URL: https://issues.apache.org/cayenne/browse/CAY-781
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 1.2 [STABLE], 2.0 [STABLE], 3.0
Environment: All.
Reporter: Michael Gentry
Assigned To: Michael Gentry
Fix For: 1.2 [STABLE], 2.0 [STABLE], 3.0
CayenneDataObject.readNestedProperty is supposed to be able to handle
Cayenne attributes (mapped and unmapped) and additionally use reflection to
find derived values consistent with JavaBeans specifications.
Given a property of "transaction.productLine.name" where:
transaction => CayenneDataObject
productLine => ProductLine object (POJO)
name => attribute of ProductLine obtained by getName()
readNestedProperty fails because when Cayenne tries to read the name using
reflection, the path it tries to parse is "e.name" instead of "name". The
math is incorrect to find the start of the "name" property:
else if (i + 1 < length) {
// read the rest of the path via introspection
return PropertyUtils.getProperty(object, path.substring
(pathIndex));
The pathIndex variable has an incorrect value and the substring is
off. It is off by 1 for every "." in the path.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.