I am while using following JCR-SQL2 Query to retrieve some files from jackrabbit repository

    SELECT id FROM [nt:file]

How do i use pagination in jackrabbit to retrieve merely a limit quantity of files.

I am talking about the COUNT in MS-SQL or LIMIT in MySQL

What about this:

Query query = queryManager.createQuery(queryString, Query.SQL);
QueryImpl q = (QueryImpl) query;
q.setOffset(10); // Start from the 10:th file
QueryResult result = q.execute();