I want to use pagination in my application. Here is a simple example:
public static List<MyClass> getPage(int page, int size) {
PagedList<MyClass> findPagedList = Ebean.find(MyClass.class).findPagedList(page,size);
return findPagedList.getList();
}
When I request the first page, I got my result without any problems, but when I ask for the second page (e.g. page = 1, size = 10), I got the following error
[PersistenceException: request threw SQLException: window functions do not support constants in ORDER BY clause expressions.
I am using MsSQL ad for the database server. How can i fix this?
thanks
PS here is the original SQL
select *
from (
select top 30
row_number() over (order by null) as rn,
t0.ID c0, t0.update_date c1, t0.create_date c2,
t0.code c3, t0.is_fulfilled c4, t0.fulfill_date c5,
t0.fulfill_request_id c6, t0.app_id c7,
t0.access_code_header_id c8, t0.product_id c9
from access_code_details t0
) as limitresult where rn > 20 and rn <= 30
My DB configurations:
db.default.url="jdbc:sqlserver://127.0.0.1:3333;databaseName=MyDB"
db.default.user=sa
db.default.password="******"
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
ebean.default.databasePlatform=com.avaje.ebean.config.dbplatform.MsSqlServer2005Platform
ebean.default="model.*"
source
share