[jboss-user] [JBoss Seam] - Boiler-plate getMaxResults for domain object List class

awhitford do-not-reply at jboss.com
Fri Jun 1 20:41:15 EDT 2007


The boiler-plate for an entity List class overrides getMaxResults with a constant:
  | @Override
  | 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:

  | myList.setMaxResults(50),
  | 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.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050635#4050635

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050635



More information about the jboss-user mailing list