Path not included in Queryresult (row.getValue)

时间:2019-04-08 13:08:10

标签: jackrabbit jcr-sql2

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!

1 个答案:

答案 0 :(得分:0)

jcr:path不是节点属性,因此不应执行所需的操作。也就是说,为什么不使用https://docs.adobe.com/docs/en/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/query/Row.html#getPath()

相关问题