Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.2 branch, 2.0 branch, 3.0
-
None
-
All.
Description
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.