Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0RC1
-
None
Description
SelectQuery.aliasPathSplits doesn't actually add the split expressions, so a test like this generates an exception:
SelectQuery query = new SelectQuery(Artist.class);
query.andQualifier(ExpressionFactory.matchExp("p.paintingTitle", "X"));
query.aliasPathSplits("paintingArray", "p");
context.performQuery(query);
INFO: *** error.
org.apache.cayenne.exp.ExpressionException: [v.3.1-SNAPSHOT ${project.build.date} ${project.build.time}] Can't resolve path component: [Artist.p].
at org.apache.cayenne.map.PathComponentIterator.invalidPathException(PathComponentIterator.java:145)
at org.apache.cayenne.map.PathComponentIterator.next(PathComponentIterator.java:133)
at org.apache.cayenne.map.PathComponentIterator.next(PathComponentIterator.java:33)
at org.apache.cayenne.access.trans.QueryAssemblerHelper.appendObjPath(QueryAssemblerHelper.java:114)
at org.apache.cayenne.access.trans.QualifierTranslator.objectNode(QualifierTranslator.java:366)
The fix is rather simple - register the aliases in the query metadata (i.e. make the method do what it is supposed to do).