Hi I'm using google app engine to create a picture hosting website and each page holds 5 images, I want to get a bool which will tell me if there is a subsequent page (they are stored in descending date order). I have a page limit and a page number so what I need is a datastore query that will:
get a single value for the rownum pagenumber * pagelimit (check if theres something stored after the 5 displaying on the page).
Currently I have:
Query query = new Query("PicturePost").addSort("date",Query.SortDirection.DESCENDING);
List<Entity> results;
results = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(pageLimit)
.offset(pageLimit*(pageNumber)));
boolean lastPage = results.isEmpty();
but this would be inefficient as it gets all 5 entities from the next page.
If anyone could help me I'd be very grateful, thankyou !