You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by John Chien <jo...@ncmail.net> on 2007/09/04 19:13:54 UTC

Re: PaginatedList

Brandon:

Thank you for the response.
Should be all four parameters be included in the  <statement > ?
If yes, how ?

<statement id="id" parameterclass="parameterObjectClass", .... ......, 
resultClass="resulyObjectClass">
   SELECT  STATEMENT
</statement>

Brandon Goodin wrote:
> There is no replacement needed. The SqlMap contains a method called 
> queryForList(String id, Object parameter, int skip, int max). See the 
> javadoc below. This will accomplish what you want. We've decided that 
> the PaginatedList is outside the scope of iBATIS and oft abused. That 
> is why we deprecated it.
>
>
>       queryForList
>
> public java.util.List *queryForList*(java.lang.String id,
>                                    java.lang.Object parameterObject,
>                                    int skip,
>                                    int max)
>
>                             throws java.sql.SQLException
>
>     Executes a mapped SQL SELECT statement that returns data to
>     populate a number of result objects within a certain range.
>
>     The parameter object is generally used to supply the input data
>     for the WHERE clause parameter(s) of the SELECT statement.
>
>     *Parameters:*
>         |id| - The name of the statement to execute.
>         |parameterObject| - The parameter object (e.g. JavaBean, Map,
>         XML etc.).
>         |skip| - The number of results to ignore.
>         |max| - The maximum number of results to return. 
>     *Returns:*
>         A List of result objects. 
>     *Throws:*
>         |java.sql.SQLException| - If an error occurs.
>
>
>       queryForList
>
> public java.util.List *queryForList*(java.lang.String id,
>                                    int skip,
>                                    int max)
>                             throws java.sql.SQLException
>   
>
>     Executes a mapped SQL SELECT statement that returns data to
>     populate a number of result objects within a certain range.
>
>     This overload assumes no parameter is needed.
>
>     *Parameters:*
>         |id| - The name of the statement to execute.
>         |skip| - The number of results to ignore.
>         |max| - The maximum number of results to return. 
>     *Returns:*
>         A List of result objects. 
>     *Throws:*
>         |java.sql.SQLException| - If an error occurs.
>
> Cheers,
> Brandon
>
> On 8/31/07, *John Chien* <john.chien@ncmail.net 
> <ma...@ncmail.net>> wrote:
>
>
>     Dear Sir:
>
>     I heard that paginated list will be removed from IBatis. Is it true ?
>     If that is true, what is the replacement ?
>
>     Thanks,
>
>     John Chien
>
>

Re: PaginatedList

Posted by Brandon Goodin <br...@gmail.com>.
Hey John,

skip and max do not need to be passed to your <select>. These values are
used when iBATIS is traversing the resultset that is returned from the
database. For example, you query the database and it has 300 potential
records returned in the resultset. If skip is set to 50 and max is set to
100, iBATIS will begin at record 50 and map the next 100 records into your
resultClass/resultMap defined objects.

Brandon

On 9/4/07, John Chien <jo...@ncmail.net> wrote:
>
>  Brandon:
>
> Thank you for the response.
> Should be all four parameters be included in the  <statement > ?
> If yes, how ?
>
> <statement id="id" parameterclass="parameterObjectClass", .... ......,
> resultClass="resulyObjectClass">
>    SELECT  STATEMENT
> </statement>
>
> Brandon Goodin wrote:
>
> There is no replacement needed. The SqlMap contains a method called
> queryForList(String id, Object parameter, int skip, int max). See the
> javadoc below. This will accomplish what you want. We've decided that the
> PaginatedList is outside the scope of iBATIS and oft abused. That is why we
> deprecated it.
>
> queryForList
>
> public java.util.List *queryForList*(java.lang.String id,
>                                    java.lang.Object parameterObject,
>                                    int skip,
>                                    int max)
>
>                             throws java.sql.SQLException
>
>  Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> The parameter object is generally used to supply the input data for the
> WHERE clause parameter(s) of the SELECT statement.
>
>   *Parameters:* id - The name of the statement to execute. parameterObject- The parameter object (
> e.g. JavaBean, Map, XML etc.). skip - The number of results to ignore. max- The maximum number of results to return.
> *Returns:* A List of result objects. *Throws:* java.sql.SQLException - If
> an error occurs.  queryForList
>
> public java.util.List *queryForList*(java.lang.String id,
>                                    int skip,
>                                    int max)
>                             throws java.sql.SQLException
>
>  Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> This overload assumes no parameter is needed.
>
>   *Parameters:* id - The name of the statement to execute. skip - The
> number of results to ignore. max - The maximum number of results to
> return. *Returns:* A List of result objects. *Throws:*
> java.sql.SQLException - If an error occurs.  Cheers,
> Brandon
>
> On 8/31/07, *John Chien* <jo...@ncmail.net> wrote:
>
>
> Dear Sir:
>
> I heard that paginated list will be removed from IBatis. Is it true ?
> If that is true, what is the replacement ?
>
> Thanks,
>
> John Chien
>
>
>
>