about the method page of JPAQuery

Asked by marc

Hi,

I am wondering how does the method page of JPAQuery works. I would use it the same way I would use LIMIT in mysql but it doesn't seem to work.

Example:
("FROM User WHERE isActive=? ORDER BY id DESC", new Object[] { 1 }).page(1,5);

Here I expect 5 results, it works.

Now I try:
("FROM User WHERE isActive=? ORDER BY id DESC", new Object[] { 1 }).page(5,10);

I expect the next 5 results from 5 but I don't get anything.

Question information

Language:
English Edit question
Status:
Solved
For:
play framework Edit question
Assignee:
No assignee Edit question
Solved by:
marc
Solved:
Last query:
Last reply:
Revision history for this message
marc (marc-ttux) said :
#1

Sorry, I meant:
("FROM User WHERE isActive=? ORDER BY id DESC", new Object[] { 1 }).page(5,5);

I expect the next 5 results from 5 but I don't get anything.

Revision history for this message
Guillaume Bort (guillaume-bort) said :
#2

First argument is page number, second is page size.
So page(1,5) give you the first 5 and page(2,5) give you the next 5.

On Mon, Feb 23, 2009 at 1:00 AM, marc
<email address hidden> wrote:
> Question #61981 on play framework changed:
> https://answers.launchpad.net/play/+question/61981
>
> marc gave more information on the question:
> Sorry, I meant:
> ("FROM User WHERE isActive=? ORDER BY id DESC", new Object[] { 1 }).page(5,5);
>
> I expect the next 5 results from 5 but I don't get anything.
>
> --
> You received this question notification because you are a member of play
> framework developers, which is an answer contact for play framework.
>

Revision history for this message
marc (marc-ttux) said :
#3

Cheers :-)