Actually, the page size will always be the same.
The trouble for me is do I have to do the query to get the whole list
again before I can return any sublist that I want to display ?
Will I be able to skip the query to get the whole list part by saving
the list in the session scope ?
If the returned list is too big, is it good to do so ?
Zarar Siddiqi wrote:
The queryForPaginatedList() retrieves all the records from the
database and simply then returns a subList based on whatever you've
set via gotoPage/nextPage and the page size. So yes, you have to pass
in pageSize every time and then set the appropriate page via
gotoPage(), nextPage() or previousPage() each time. It's somewhat a
manual process.
If this is a large query, I'd actually recommend just writing the SQL
which efficiently gets the correct set of records that you want.
(E.g: LIMIT in MySQL or TOP in SQL Server)
Zarar Siddiqi
----- Original Message ----- From: "John Chien" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 12, 2006 12:26 PM
Subject: Re: pager in ibatis
L:arry:
Thank you for the information.
The queryForPaginatedList() will return a list, then I can check for the
existence of successive records by calling the isNextPageAvailable().
and go to that page by calling gotoPage();
However, I can not keep this list in my server due to concurrecy reason.
Does that mean that I have to call the same method every time and give
it the page number for it to return me the records ?
I am doing the web development.
How can I make use of this returned list in JSP with Struct
development ?
Should I keep the list in the session or request scope ?
Thanks,
John Chien
Larry Meadors wrote:
queryForPaginatedList()
Larry
On 4/12/06, John Chien <[EMAIL PROTECTED]> wrote:
Dear sir:
I have a feature that requires me to return query result of a
selection
statment in certain amount of successive records every time.
This is just like a page.
For example:
SELECT id, name
FROM employee;
The selection result of this statement is a list.
However, I want to only get 30 records every time.
For the first call, I want to get the first 30 (1 - 30) records, for
thext call, I would like to get the next 30 (31 - 60) records.
How can I do this in Ibatis ?
Thanks,
John Chien
begin:vcard
fn:John Chien
n:Chien;John
email;internet:[EMAIL PROTECTED]
tel;work:919-715-2510
version:2.1
end:vcard