4 Replies Latest reply on May 30, 2007 6:15 PM by Fumihiko Sugiyama

    EntityQuery.nextExists not working correctly?

    Fumihiko Sugiyama Newbie

      Hi,
      I'm new in JBoss Seam and reading Yuan's Seam Book.
      I want to display multipage query results with EntityQuery(Seam CRUD App Framework).
      I want to display 3 data records(EntityQuery#getMaxResults) per page, and now there are 6 data records in database table.
      Then there are "Next Page" and "Last Page" links in first page. That's OK.
      But there are also in second page! (i.e. #{fans.nextExists) returns true regardless of no next data records)
      When I click "Next Page" or "Last Page" link in second page, third page is displayed without data records( and next/last paging links).
      Why "Next/Last Page" links are displayed in second page regardless of no next data records?

       <s:link view="/fans.xhtml"
       rendered="#{fans.previousExists}"
       value="#{messages.left}#{messages.left} First Page"
       id="firstPage">
       <f:param name="firstResult" value="0"/>
       </s:link>
      
       <s:link view="/fans.xhtml"
       rendered="#{fans.previousExists}"
       value="#{messages.left} Previous Page"
       id="previousPage">
       <f:param name="firstResult"
       value="#{fans.previousFirstResult}"/>
       </s:link>
      
       <s:link view="/fans.xhtml"
       rendered="#{fans.nextExists}"
       value="Next Page #{messages.right}"
       id="nextPage">
       <f:param name="firstResult"
       value="#{fans.nextFirstResult}"/>
       </s:link>
      
       <s:link view="/fans.xhtml"
       rendered="#{fans.nextExists}"
       value="Last Page #{messages.right}#{messages.right}"
       id="lastPage">
       <f:param name="firstResult"
       value="#{fans.lastFirstResult}"/>
       </s:link>
      


      @Name("fans")
      public class PersonList extends EntityQuery {
       ......
      
       @Override
       public String getEjbql() {
       return "select p from Person p";
       }
      
      
       @Override
       public Integer getMaxResults() {
       return 3;
       }
      
       ......
      }
      


      [environment]
      JBoss AS 4.0.5.GA( & HSQLDB)
      JBoss Seam 1.2.1.GA