// applying sort
SortField sortField = new SortField("age", SortField.INT);
Sort sort = new Sort(sortField);
cacheQuery.sort(sort);
ResultIterator iterator = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.EAGER));
assert cacheQuery.getResultSize() == 4 : cacheQuery.getResultSize();
int previousAge = 0;
while (iterator.hasNext()) {
Person person = (Person) iterator.next();