Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1361

SelectQuery.aliasPathSplits does nothing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0RC1
    • 3.0RC2
    • Core Library
    • 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).

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: