When I use paging via a subclass of EntityQuery I noticed that only the first 
page and second page work, but after that I can't step to the 3rd page. 
The value of firstResult is always 'null' when the next() call is started.

I use:
jboss seam 2.0.0. GA
jboss AS 4.2.2 GA

I test with 8 records in the database

------------------------ cardslist.java ----------------

import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.framework.EntityQuery;
  | import org.jboss.seam.log.Log;
  | 
  | @Name("cardsList")
  | public class CardsList extends EntityQuery
  | {
  |     private static final long serialVersionUID = 1L;
  |     
  |     @SuppressWarnings("unused")
  |     @Logger 
  |     static private Log log;
  |     
  |     /**
  |      * default constructor
  |      */
  |     public CardsList() {
  |             setMaxResults(2);
  |             setOrder("id");
  |     }
  |     
  |     @Override
  |     public String getEjbql() 
  |     { 
  |         return "select cards from Cards cards";
  |     }
  |     
  |     
  |     /**
  |      * @see org.jboss.seam.framework.Query#setFirstResult(java.lang.Integer)
  |      */
  |     @Override
  |     public void setFirstResult(Integer firstResult) {
  |             log.error("set first result:" + firstResult);
  |             super.setFirstResult(firstResult);
  |     }
  | 
  |     
  |     /**
  |      * @see org.jboss.seam.framework.Query#getFirstResult()
  |      */
  |     @Override
  |     public Integer getFirstResult() {
  |             log.error("get first result:" + super.getFirstResult());
  |             return super.getFirstResult();
  |     }
  | 
  |     @Override
  |     public void next()
  |     {
  |             log.error("first result:" + getFirstResult());
  |             log.error("max result:" + getMaxResults());     
  |             log.error("next first result:" + getNextFirstResult());
  |             super.next();
  |     }
  |     
  |     
  |     /**
  |      * otherwise the isNextExists() call result in a bad result the first 
page.
  |      */
  |     @Override
  |     public boolean isNextExists() {
  |             return getResultList() != null
  |                             && getResultCount() > (getFirstResult() != null 
? getFirstResult()
  |                                             : 0)
  |                                             + getMaxResults();
  |     }
  |     
  | }
  | 
------------------------------ part of cardslist.xhtml 
-----------------------------

  |         <h:outputText value="Item #{cardsList.firstResult + 
1}..#{cardsList.firstResult + cardsList.maxResults} of 
#{cardsList.resultCount}"/> 
  | 
  |         <h:commandLink action="#{cardsList.previous}" value="Previous 
#{cardsList.maxResults} " 
  |             rendered="#{cardsList.previousExists}"/>   
  |         <h:commandLink action="#{cardsList.next}" value="Next 
#{cardsList.maxResults}"  
  |                     rendered="#{cardsList.nextExists}"/>  
  | 

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103510
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to