Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2261

Can't execute queries with multiple selectors via REST API

    Details

    • Steps to Reproduce:
      Hide

      Populated repository with cars.cnd and cars-system-view.xml from Modeshape JCR query tests and executed the following query via REST API:

      QUERY="SELECT car.*, category.[jcr:primaryType] from [car:Car] as car JOIN [nt:unstructured] as category ON ISDESCENDANTNODE(car,category) WHERE NAME(category) LIKE 'Utility'"
      curl -b ${COOKIE_JAR} -H 'Accept: text/plain' -H 'Content-Type: application/jcr+sql2' -d "${QUERY}" ${JCR_API_URL}/query
       

      Following exception gets thrown:

      22 Jul 2014 19:28:16,444 279102 [http-bio-8670-exec-19] ERROR org.modeshape.web.jcr.rest.ModeShapeExceptionMapper - Server error
      javax.jcr.RepositoryException: Selector name must be specified when the query contains multiple selectors: SELECT car.*, category.[jcr:primaryType] from [car:Car] as car JOIN [nt:unstructured] as category ON ISDESCENDANTNODE(car,category) WHERE NAME(category) LIKE 'Utility'
      at org.modeshape.jcr.query.JcrQueryResult$AbstractRow.getPath(JcrQueryResult.java:530)
      at org.modeshape.web.jcr.rest.handler.RestQueryHandler.createLinksFromNodePaths(RestQueryHandler.java:167)
      at org.modeshape.web.jcr.rest.handler.RestQueryHandler.setRows(RestQueryHandler.java:157)
      at org.modeshape.web.jcr.rest.handler.RestQueryHandler.executeQuery(RestQueryHandler.java:93)
      at org.modeshape.web.jcr.rest.ModeShapeRestService.postJcrSql2Query(ModeShapeRestService.java:739)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
       
      Show
      Populated repository with cars.cnd and cars-system-view.xml from Modeshape JCR query tests and executed the following query via REST API: QUERY= "SELECT car.*, category.[jcr:primaryType] from [car:Car] as car JOIN [nt:unstructured] as category ON ISDESCENDANTNODE(car,category) WHERE NAME(category) LIKE 'Utility' " curl -b ${COOKIE_JAR} -H 'Accept: text/plain' -H 'Content-Type: application/jcr+sql2' -d "${QUERY}" ${JCR_API_URL}/query Following exception gets thrown: 22 Jul 2014 19:28:16,444 279102 [http-bio-8670-exec-19] ERROR org.modeshape.web.jcr. rest .ModeShapeExceptionMapper - Server error javax.jcr.RepositoryException: Selector name must be specified when the query contains multiple selectors: SELECT car.*, category.[jcr:primaryType] from [car:Car] as car JOIN [nt:unstructured] as category ON ISDESCENDANTNODE(car,category) WHERE NAME(category) LIKE 'Utility' at org.modeshape.jcr.query.JcrQueryResult$AbstractRow.getPath(JcrQueryResult.java:530) at org.modeshape.web.jcr. rest .handler.RestQueryHandler.createLinksFromNodePaths(RestQueryHandler.java:167) at org.modeshape.web.jcr. rest .handler.RestQueryHandler.setRows(RestQueryHandler.java:157) at org.modeshape.web.jcr. rest .handler.RestQueryHandler.executeQuery(RestQueryHandler.java:93) at org.modeshape.web.jcr. rest .ModeShapeRestService.postJcrSql2Query(ModeShapeRestService.java:739) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483)

      Description

      Modeshape returns an exception when trying to execute query with multiple selectors via REST API.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                eldaryus Eldar Yusupov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: