You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Grégory OLIVER (JIRA)" <ji...@apache.org> on 2012/11/15 22:41:13 UTC

[jira] [Created] (JCR-3458) Remote SPI connection getNodes() throw NoSuchElementException

Grégory OLIVER created JCR-3458:
-----------------------------------

             Summary: Remote SPI connection getNodes() throw NoSuchElementException
                 Key: JCR-3458
                 URL: https://issues.apache.org/jira/browse/JCR-3458
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-jcr2spi
    Affects Versions: 2.4.3
         Environment: Linux
            Reporter: Grégory OLIVER


With the remote spi connection, it seems that the inner/outer join doesn't work with the result.getNodes() function.

My code : 
Repository repository = JcrUtils.getRepository(jcrUrl); 
Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
String expression = ...;
QueryManager queryMgr = session.getWorkspace().getQueryManager();
Query query = queryMgr.createQuery(expression,Query.JCR_SQL2);
QueryResult result = query.execute();
Node node = result.getNodes().nextNode();

Query1 :
select node.* from [nt:unstructured] as node
Return one element.

Query2 :
select node.* from [nt:unstructured] as node
left outer join [nt:file] as file on ischildnode(file, node)
left outer join [nt:resource] as filecontent on ischildnode(filecontent, file) 
Doesn't return any element :
java.util.NoSuchElementException
    at org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl.nextNode(NodeIteratorImpl.java:110)


The second query should return at least one element due to left outer join.


A solution is to use ( work with both query )
Node node = result.getRows().nextRow().getNode("node");


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira