IMO, I don't think you can have an universal solution. Paging is not
included as a standard feature in SQL specifications (see SQL
standardization <http://en.wikipedia.org/wiki/SQL#Standardization>). Hence,
pagination is an extension for DBMS. So different vendors have implemented
it in different manners. Therefore you cannot have an universal solution.
You have to tackle different DBMS manually.

Even though you cannot have RDBMS universal solution, you can use JPA and
it will handle different DBMS for you. E.g.
   Query q = ...;
   q.setFirstResult (0);

  q.setMaxResults (10);





On Mon, Mar 2, 2015 at 8:31 AM, Dulitha Wijewantha <duli...@wso2.com> wrote:

> Hi guys,
> I am working on creating a device listing API that supports pagination. In
> the SQL world, LIMIT and OFFSET seems to be the standard way of doing
> pagination in MySQL and PostgreSQL. Below is an example,
>
> SELECT Device.id, Device.name FROM Device
> LIMIT 10 OFFSET 10
>
>
> But Oracle seems to be using rownum. What's the recommended approach in
> doing this?
>
> Cheers~
>
> --
> Dulitha Wijewantha (Chan)
> Software Engineer - Mobile Development
> WSO2 Inc
> Lean.Enterprise.Middleware
>  * ~Email       duli...@wso2.com <duli...@wso2mobile.com>*
> *  ~Mobile     +94712112165 <%2B94712112165>*
> *  ~Website   dulitha.me <http://dulitha.me>*
> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>   *~Github     @dulichan <https://github.com/dulichan>*
>   *~SO     @chan <http://stackoverflow.com/users/813471/chan>*
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to