3 Replies Latest reply on Jun 2, 2007 3:36 PM by Gavin King

    Boiler-plate getMaxResults for domain object List class

    Anthony Whitford Newbie

      The boiler-plate for an entity List class overrides getMaxResults with a constant:

      public Integer getMaxResults() {
       return 25;

      Why is this done (or necessary)? The underlying Query (http://fisheye.jboss.com/browse/JBoss/jboss-seam/src/main/org/jboss/seam/framework/Query.java? r=1.32) class already has a property:
      public Integer getMaxResults()
       return maxResults;

      Users could set this variable in a constructor if they want to override the default 25.

      I am surprised to see the getMaxResults return a constant because it means that the getter is inconsistent with the setter. For example, the following assertion fails:
      assert 50 == myList.getMaxResults();

      It just doesn't seem right... And I don't see why I shouldn't be able to change the result set size.

      Note that the EntityQuery class (or Query) should specify a default initialization for maxResults.