Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 95245 invoked from network); 26 Apr 2006 07:22:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2006 07:22:04 -0000 Received: (qmail 14921 invoked by uid 500); 26 Apr 2006 07:22:02 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 14908 invoked by uid 500); 26 Apr 2006 07:22:02 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 14897 invoked by uid 99); 26 Apr 2006 07:22:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 00:22:02 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=DEAR_SOMETHING,NO_REAL_NAME,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of erlend.bjorge@aftenposten.no designates 80.91.34.51 as permitted sender) Received: from [80.91.34.51] (HELO mx1.aftenposten.no) (80.91.34.51) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 00:21:59 -0700 Received: from localhost (amavis-mx1.aftenposten.no [80.91.34.52]) by mx1.aftenposten.no (Postfix) with ESMTP id 374B7D26492 for ; Wed, 26 Apr 2006 09:21:37 +0200 (CEST) Received: from mx1.aftenposten.no ([80.91.34.51]) by localhost (amavis-mx1.aftenposten.no [80.91.34.52]) (amavisd-new, port 10024) with LMTP id 58321-01-9 for ; Wed, 26 Apr 2006 09:21:35 +0200 (CEST) Received: from smtp1.aftenposten.no (unknown [80.91.34.6]) by mx1.aftenposten.no (Postfix) with ESMTP id E036ED264C9 for ; Wed, 26 Apr 2006 09:21:35 +0200 (CEST) Received: from sch-mail-06.schibsted.no (unverified) by smtp1.aftenposten.no (Content Technologies SMTPRS 4.3.14) with ESMTP id for ; Wed, 26 Apr 2006 09:23:39 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: SV: pager in ibatis Date: Wed, 26 Apr 2006 09:21:34 +0200 Message-ID: <013F0E81D349EC42A14CD3242BC61AFF02A1BB0D@sch-mail-06.schibsted.no> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: pager in ibatis Thread-Index: AcZeVi7KMRngruHBRmqfjhM2ueriJgAPAT+AApsteIA= From: To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi there! I think it's better off making the paging logic yourself in the application, and then querying only the records you want to show, for example in oracle you can use the rownum to fetch the data like select * from=20 (select rownum row, a.* from tabel1 as a) where row between 21 and 30 Why not use the ibatis the queryForList with "pageNumber and pageSize" = parameters like this: sqlMap.queryForList("searchCompanies", searchText, ((pageNumber-1) * = pageSize), pageSize); ?? Then you only keep track of the pageNumber you are at and don't need to = make your query database specific... and you don't worry about the = caching, it cache the page you are at and only that as far as I have = understood it. You also need the countSearchCompanies, with an exactly the same query = but with count in it ..... to find out how many pages it totally for = that search. So you can specifiy page 1, 2, 3, 4 in e.g. your webpage. We use this strategy with success here: http://www.aguiden.no (search for sykkel (bike),gives you two pages) Since queryForPaginatedList don't have a count (??), I don't think it = load the totally result set, only the page you are at, and have lazy = loading of the next page... smooth. So far as I have understood it.... ??? Take care, Erlend ------------------------------------------- -----Opprinnelig melding----- Fra: Yusuf [mailto:Yusuf@ekalife.co.id]=20 Sendt: 13. april 2006 02:44 Til: user-java@ibatis.apache.org Emne: RE: pager in ibatis I think it's better off making the paging logic yourself in the application, and then querying only the records you want to show, for example in oracle you can use the rownum to fetch the data like select * from=20 (select rownum row, a.* from tabel1 as a) where row between 21 and 30 because using the queryForPaginatedList (without caching) will always fetch the entire result and then showing only the selected records, and if the record count is high (like thousands..) then the performance will be bad. cmiiw, Yusuf. -----Original Message----- From: John Chien [mailto:john.chien@ncmail.net] Sent: Wednesday, April 12, 2006 11:27 PM To: user-java@ibatis.apache.org 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=20 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 wrote: > =20 > >>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 >> >> >> >> =20 >>