Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JCR jackrabbit pagination

I'm using the following JCR-SQL2 Query to retrieve some files from jackrabbit repository

    SELECT id FROM [nt:file]
  WHERE ISDESCENDANTNODE([/repo/cms]) 

How can I use pagination in jackrabbit to retrieve only a limit number of files.

I mean the COUNT in MS-SQL or LIMIT in MySQL

like image 514
Ammar Bozorgvar Avatar asked Sep 17 '11 06:09

Ammar Bozorgvar


1 Answers

How about this:

Query query = queryManager.createQuery(queryString, Query.SQL);
QueryImpl q = (QueryImpl) query;
q.setLimit(10);
q.setOffset(10); // Start from the 10:th file
QueryResult result = q.execute();
like image 93
Per Avatar answered Nov 05 '22 00:11

Per