title: JCR SQL2 query obviously not delivering any results
body: <p>I'm trying to create a page for CQ based on the jcr API. I'd like to query pages containing a specific string in a property.</p>
  
  <p>The query itself (JCR-SQL2) is the following (I tested it on the CQ Web interface and it delivers results):</p>
  
  <pre><code>SELECT
      *
  FROM 
      [nt:base] AS s
  WHERE
      ISDESCENDANTNODE([/content])
  AND
      s.[sling:resourceType] = 'some/path/to/destination'
  </code></pre>
  
  <p>This was my try in the JSP page:</p>
  
  <pre><code>    String stmt = "SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content]) AND s.[cq:template] = 'some/path/to/destination'";
      Query query = currentNode.getSession().getWorkspace().getQueryManager().createQuery(stmt, Query.JCR_SQL2);
      QueryResult results = query.execute();
      if (results.getNodes() != null &amp;&amp; results.getNodes().hasNext()) {
          NodeIterator it = results.getNodes();
  
          while (it.hasNext()) {
              Node node = it.nextNode();
              String npath = node.getPath();
              Page contentPage = pageManager.getContainingPage(resourceResolver.getResource(npath));
              String title = contentPage.getTitle();
              String path = contentPage.getPath() + ".html";
              %&gt;
              &lt;div class="searchresult"&gt;&lt;a href="&lt;%= path %&gt;"&gt;&lt;%= title %&gt;&lt;/a&gt;&lt;/div&gt;
              &lt;%
          }
      }
  </code></pre>
  
  <p>The error thrown is the following:</p>
  
  <pre><code>Caused by: javax.jcr.RepositoryException: This query result has already been iterated through
  </code></pre>