thank you  Luciano, I read the guide before, but it is not what I want.

I have a method for querying records of a specific page. I want to design a
Data Object for encapsulating all the pagination information in it, so that
this method can return the Data Object to client.

public DataObject queryForPage(String commandName, Object parameter, int
pageNum, int pageSize) throws DaoException {
       try {
           Connection conn = dataSource.getConnection();
           conn.setAutoCommit(false);
           DAS das = DAS.FACTORY.createDAS(configStream, conn);
           Command command = das.getCommand(commandName);
           if (parameter != null)
               command.setParameter(1, parameter);

           // DataObject root=null;
           Pager pager = new PagerImpl(command, pageSize);
           // while(pageNum-->0) root=pager.next();

           return pager.getPage(pageNum);
       } catch (Exception e) {
           throw new DaoException(e);
       }
   }

I have designed a object for it.
public interface Page extends DataObject
{

 int getRecordCount();
 void setRecordCount(int value);

 int getPageCount();
 void setPageCount(int value);


 int getPageSize();
 void setPageSize(int value);


 int getPageNum();
 void setPageNum(int value);

 List getResults();
 void setResults(List results);
} // Page

Reply via email to