You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ulrich <Fo...@gombers.de> on 2013/06/17 10:01:25 UTC

JCR-JQOM: JOIN returns Message: WARN NodeIteratorImpl - Exception retrieving Node with Id: null

Still fighting with JCR-JQOM:
I need to retrieve "jcr:lastModified" from jcr:contend-childnode of every
nt:file-Node. My approach is:

Selector ntFileSelector = qomf.selector("nt:file", "Parent");
Selector jcrContentSelector = qomf.selector("nt:resource", "Child");
Join join = qomf.join(ntFileSelector, jcrContentSelector,
QueryObjectModelFactory.JCR_JOIN_TYPE_INNER,
     qomf.childNodeJoinCondition(jcrContentSelector.getSelectorName(),
ntFileSelector.getSelectorName()));
Constraint getSubtree = qomf.descendantNode(ntFileSelector.getSelectorName(),
subtree);
QueryObjectModel qom = qomf.createQuery(join, getSubtree, null, null);
QueryResult queryResult = qom.execute();
nodeIterator = queryResult.getNodes();

>From this I get four times the message:
   WARN  NodeIteratorImpl - Exception retrieving Node with Id: null
This means I get this message for every node which I expected to be selected
within the subtree.

If I run the query without the "JOIN":
QueryObjectModel qom = qomf.createQuery(ntFileSelector, getSubtree, null, null);
it is fine.

brdgs,
Ulrich

Re: JCR-JQOM: JOIN returns Message: WARN NodeIteratorImpl - Exception retrieving Node with Id: null

Posted by Ulrich <Fo...@gombers.de>.
Now I could create a SQL2 statement which delivers me the same result:

   "Select * from [nt:file] as parent " +
   "inner join [nt:resource] as child on ISCHILDNODE(child,parent) " +
   "WHERE ISDESCENDANTNODE(parent,[/content/testit])";

Do I have a logic problem here? I'm search the whole subtree of
"/content/testit" fo all nodes of type "nt:file" which have a child of type
"nt:resource".
The query should return me 4 nodes but instead it gives me four times the
message:
    "WARN  NodeIteratorImpl - Exception retrieving Node with Id: null"

Ulrich




> .. snip ..

>
> > Ulrich <Fo...@gombers.de> hat am 17. Juni 2013 um 10:01 geschrieben:
> >
> >
> > Still fighting with JCR-JQOM:
> > I need to retrieve "jcr:lastModified" from jcr:contend-childnode of every
> > nt:file-Node. My approach is:
> >
> > Selector ntFileSelector = qomf.selector("nt:file", "Parent");
> > Selector jcrContentSelector = qomf.selector("nt:resource", "Child");
> > Join join = qomf.join(ntFileSelector, jcrContentSelector,
> > QueryObjectModelFactory.JCR_JOIN_TYPE_INNER,
> >      qomf.childNodeJoinCondition(jcrContentSelector.getSelectorName(),
> > ntFileSelector.getSelectorName()));
> > Constraint getSubtree =
> > qomf.descendantNode(ntFileSelector.getSelectorName(),
> > subtree);
> > QueryObjectModel qom = qomf.createQuery(join, getSubtree, null, null);
> > QueryResult queryResult = qom.execute();
> > nodeIterator = queryResult.getNodes();
> >
> > From this I get four times the message:
> >    WARN  NodeIteratorImpl - Exception retrieving Node with Id: null
> > This means I get this message for every node which I expected to be selected
> > within the subtree.
> >
> > If I run the query without the "JOIN":
> > QueryObjectModel qom = qomf.createQuery(ntFileSelector, getSubtree, null,
> > null);
> > it is fine.
> >
> > brdgs,
> > Ulrich

Re: JCR-JQOM: JOIN returns Message: WARN NodeIteratorImpl - Exception retrieving Node with Id: null

Posted by Ulrich <Fo...@gombers.de>.
I tried the same example with JCR-SQL2. This fails for another reason - but may
help to understand what I try to do:

queryString = "select * from [nt:file] as parent " +
              "inner join [nt:resource] as child on ISCHILDNODE(child,parent)" +
               "WHERE ISDESCENDANTNODE([descendant],/content/testit)";

Here I get an Exception; there is probably a syntax error in the queryString.
(I'm not familiar with the syntax).

Exception in thread "main" javax.jcr.query.InvalidQueryException: Query:
select * from [nt:file] as parent inner join [nt:resource] as child on
ISCHILDNODE(child,parent)WHERE
ISDESCENDANTNODE([descendant],/content(*)/testit); expected: )

Ulrich


> Ulrich <Fo...@gombers.de> hat am 17. Juni 2013 um 10:01 geschrieben:
>
>
> Still fighting with JCR-JQOM:
> I need to retrieve "jcr:lastModified" from jcr:contend-childnode of every
> nt:file-Node. My approach is:
>
> Selector ntFileSelector = qomf.selector("nt:file", "Parent");
> Selector jcrContentSelector = qomf.selector("nt:resource", "Child");
> Join join = qomf.join(ntFileSelector, jcrContentSelector,
> QueryObjectModelFactory.JCR_JOIN_TYPE_INNER,
>      qomf.childNodeJoinCondition(jcrContentSelector.getSelectorName(),
> ntFileSelector.getSelectorName()));
> Constraint getSubtree = qomf.descendantNode(ntFileSelector.getSelectorName(),
> subtree);
> QueryObjectModel qom = qomf.createQuery(join, getSubtree, null, null);
> QueryResult queryResult = qom.execute();
> nodeIterator = queryResult.getNodes();
>
> From this I get four times the message:
>    WARN  NodeIteratorImpl - Exception retrieving Node with Id: null
> This means I get this message for every node which I expected to be selected
> within the subtree.
>
> If I run the query without the "JOIN":
> QueryObjectModel qom = qomf.createQuery(ntFileSelector, getSubtree, null,
> null);
> it is fine.
>
> brdgs,
> Ulrich