Which DB are you using? For example, in Oracle something like this works:
select *
from ( select a.*, rownum rnum
from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
where rownum <= MAX_ROWNUM )
where rnum >= MIN_ROWNUM
The nice thing about this technique is you can page just about anything with
it. Similar stuff in DB2.
Given this approach, I'd love to hear how people have modularized this using
iBatis to support "page mode" for any query. Hadn't thought about that much.
Cheers,
Steve
________________________________
From: anton [mailto:antonkurniadi@xxxxxxxxxxxxxxx]
Sent: Thu 2005-09-29 7:27 PM
To: user-java@xxxxxxxxxxxxxxxxx
Subject: Question about paginated list.
Hi,
Recently im working with paging feature in my web application, and I need to
get a ranged results from a query, lets say that my query will get 10.000
records but I want to get only 10 records from it,(eg starting from record
9.980 until record 9.990), I already know iBATIS paginated list but it doesn't
solve my problem since the queryForPaginatedList() method retrieve all the
10.000 records. Does anyone here know how can I achieve that (Hibernate already
come with the Query.setFirstResult() and Query.setMaxResult() method to solve
this)? Thank You.
<<winmail.dat>>
|
|