Reputation: 838
I am using kundera-cassandra (V3.2) and want to limit a select query. This is working with following code:
TypedQuery<T> query = manager.createQuery(criteriaQuery);
query.setMaxResults(limit);
My problem is to set a start parameter. I found the method
query.setFirstResult(start);
but it does not work. Is there any solution available to tell the select query from where to start? I cannot do that on application level because the query is used by a REST service method.
Upvotes: 1
Views: 233
Reputation: 1685
Kundera supports Cassandra Pagination via the Datastax Driver.
The following is an excerpt from the Kundera readmes:
Pagination : You can paginate the query results fetched from Cassandra using Datastax driver via ResultIterator :
String queryString= "Select t from Token t";
com.impetus.kundera.query.Query query = (com.impetus.kundera.query.Query) em.createQuery(queryString,
Token.class);
query.setFetchSize(fetchSize);
int count=0;
Iterator<Token> tokens = query.iterate();
while(tokens.hasNext())
{
...
}
Upvotes: 1
Reputation: 13640
You are looking for limit, offset
queries and they are not supported by Kundera-Cassandra
as there is no support on Cassandra natively.
Upvotes: 2