jackrabbitjcr-sql2

Path not included in Queryresult (row.getValue)


we still have Jackrabbit 2 (2.18.0) in use and I have a problem with loading the "jcr:path" in the Query-Result.

In this example we have a custom node "org:permission" with a custom property "org:permissionHolderIds".

The custom property is filled in values in the found rows.

String queryString = "SELECT [jcr:path], [org:permissionHolderIds] FROM [org:permission]";

QueryManager queryManager = session.getWorkspace().getQueryManager();
Query query = queryManager.createQuery(queryString, Query.JCR_SQL2);
QueryResult queryResult = query.execute();
RowIterator rows = queryResult.getRows();
Row r = rows.nextRow();

String holder= r.getValue("org:permissionHolderIds").getString();
// is filled properly

String path = r.getValue("jcr:path").getString();
// path is empty all the time :-(

Until now we iterated over the found nodes but this causes additional data base queries and is slow. So we tried to improve our performance and fetch all the necessary data in the query.

Thank you!


Solution

  • jcr:path is not a node property, so this is not supposed to do what you want. That said, why don't you use https://docs.adobe.com/docs/en/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/query/Row.html#getPath()?