I am creating a web page where user can select datasource and execute select statements
and see the paginated results in table.
Now for pagination i am wrapping queries to get total row count and rownum to fetch a particular block of rows.
As we add support for more and more databases, things are getting complex as not all db servers support the same syntax for sql.
In IDEs like netbeans which have sql result viewers, they are able to display “SELECT” query results in paginated way.
So wanted to know how this can be done in generic way or how this IDEs do it.
Many databases support pagination with something like that
(WHERE ROW_ID >= 30 and ROWNUM <= 10)– (it’s just abstract example, look at your DB spec). Good way to don’t worry about pagination is to use some framework like Hibernate:E.g. you can use methods
Criteria.setFirstResult()andCriteria.setMaxresults()