Hi all,

I just added support to the Isis core and applib for Paged datastore 
queries.

These extensions don't change any existing behaviour, but do expose 
a new query type to the user space: QueryFindAllPaged

A simple usage example:
    public List<SimpleClass> someSimpleClasses(final long startIndex, final 
long rowCount) {
        Query<SimpleClass> query = new 
QueryFindAllPaged<SimpleClass>(SimpleClass.class, startIndex, rowCount);
        return allMatches(query);
    }

Inside PersistenceSession, "QueryFindAllPaged" is mapped onto 
"PersistenceQueryFindPaged", which is available to the data stores.

The SQL-OS has a simple implementation that adds "LIMIT 
<startIndex>, <rowCount>" to the end of the SQL statement.

This will have to be edited for each database engine: I belive mysql 
and postgresql have an incompatible syntax... but I believe it should 
be possible to easily define a way to specify the custom string in the 
properties file.

There is a simple test in SqlDomainObjectRepository that just checks 
that the expected number of instances are returned. It works against 
HSQLDB.

May you find this extension useful! 

Reply via email to