code: private void queryForCoursesWithMaxStudentCount() {
  		//TODO `MAX` in queries doesn't work yet, so we use navigation
  		Extent<Course> courses = pm.getExtent(Course.class);
  		Course maxCourse = null;
  		int maxStudents = -1;
  		for (Course c: courses) {
  			if (c.getStudents().size() > maxStudents) {
  				maxStudents = c.getStudents().size();
  				maxCourse = c;
  			}
  		}
  		if (maxCourse != null) {
  			System.out.println(">> Query for course with most students returned: " +
  					maxCourse.getName());
  		} else {
  			System.out.println(">> Query for course with most students returned no courses.");
  		}
  	}
docs: This example demonstrates that using 'navigation'may often be a good alternative
  for queries, especially if the term in question (collection.size()) cannot be indexed yet.