Is it possible to get a query result by a interval?
I was think something like that:
List<Object> getRangeQuery(Object example, int beginIndex, int endIndex){
ObjectSet<Object> set = db.queryByExample(example);
return set.subList(beginIndex, endIndex);
}
My intention is to fill a table where I gonna limit the list by "pages". But I think that way won't perform well.
How far I've researched I didn't find a way to do it natively.Any suggestion? Thanks.
This is the correct way yes. There is not explicit limit operation.
The query result (
ObjectSet
) is a lazy loaded result. It will only load the objects and ranges requested. So, it will only load the range of the sub-list you requested.