I have my classic paginated query already in a properties file, which deals with approx 50000-100000 rows and i have decided that every page i will fetch no more than 5000 rows, now I need help writing a JAVA JDBC Snippet, where I can use the multiple pages of query result returned by the query and handle it using result set -- may be a loop which I am not able to write.
Additionally, Is fetch size the other better alternative to this instead of using the classic pagination? My query:
SELECT *
FROM  (
   SELECT id, col1, col2, rownum rn
   FROM (
      SELECT /*+ first_rows(5000) */ id, col1, col2
      FROM   table1
      ORDER  BY id DESC
   )
   WHERE   rownum <= 5000
)
WHERE  rn >= 1;
Eventaully i need help with java snippet in core java JDBC flavour.