You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Graeme Rocher <gr...@yahoo.co.uk> on 2007/02/12 16:04:26 UTC
Pagination of results & position() comparison queries
Hi,
I'm trying to figure out how to go about doing some form of pagination
of query results. In Hibernate app you would likely use the
setFirstResult and setMaxResults properties to manipulate the result
set. However, Hibernate handles the various SQL dialect issues around
data pagination for you.
I tried the following with an xpath query:
//wiki:WikiEntry[(position() > 10) and (position() < 20)]
which I was hoping would return me all the "WikiEntry" items between
10 and 20, however it throws this exception:
javax.jcr.query.InvalidQueryException: Unsupported expression with
position(). Only = is supported.
So given that this kind of comparison is not supported with the
position() function, how would I go about creating the query I'm
after? Is it possible at all?
Regards,
--
Graeme Rocher
Grails Project Lead
http://grails.org
Re: Pagination of results & position() comparison queries
Posted by Marcel Reutegger <ma...@gmx.net>.
Graeme Rocher wrote:
> I'm trying to figure out how to go about doing some form of pagination
> of query results. In Hibernate app you would likely use the
> setFirstResult and setMaxResults properties to manipulate the result
> set. However, Hibernate handles the various SQL dialect issues around
> data pagination for you.
there is a related enhancement request pending in jira, which does something
similar: http://issues.apache.org/jira/browse/JCR-679
> I tried the following with an xpath query:
>
> //wiki:WikiEntry[(position() > 10) and (position() < 20)]
>
> which I was hoping would return me all the "WikiEntry" items between
> 10 and 20, however it throws this exception:
>
> javax.jcr.query.InvalidQueryException: Unsupported expression with
> position(). Only = is supported.
>
> So given that this kind of comparison is not supported with the
> position() function, how would I go about creating the query I'm
> after? Is it possible at all?
for now you should use the skipTo() method on the NodeIterator or the
RowIterator returned by the QueryResult.
regards
marcel