permaculture playing cards
The moose likes JDBC and Relational Databases and the fly likes Pagination Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Pagination Issue" Watch "Pagination Issue" New topic

Pagination Issue

kishore kovil

Joined: Dec 21, 2006
Posts: 20

Currently , I'm dealing with pagination .
I'm tryiing to do it by query.
but,i'm n't successful.
Pls. help me.


My query is:
String query = "Select * from (Select a.*, rownum rnum From (select * from "
+ TableDetails
+ " order by rowid desc)a where rownum <= "
+ (recordsPerPage * (Integer.parseInt(pageNumber)))
+ ") where rnum >"
+ (recordsPerPage * ((Integer.parseInt(pageNumber) - 1)))
+ "";

with this query,
I'm not able to get all the results.
I'm missing some records.(say, missing 2 of 6)
I mean, this is working fine for Next button in jsp , but not for Previous button.

How can i modify the query?

Pls help me.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32628

First, try printing out the query. Are the indices what you expect?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Pagination Issue
It's not a secret anymore!