Hi Felix,

I believe this is happenning when you're doing a copy from
query-returned List to new ArrayList. It iterates though original list
and every get(i) causes a new query. Is there a strong reason you need
to do this?

2011/4/5 felix <[email protected]>:
> Hi,
>
> I have integrated cayenne with a web framework (wicket) and pagination is
> crucial for the project we are implementing, however it doesnt seem to work,
> and im not sure whether im doing something wrong or I dont not understand
> the concept
>
> (there are 1004 'Proposal' objects in the database)
>
> When I do:
> -------------
>                SelectQuery q = new SelectQuery(Proposal.class);
>                q.setPageSize(50);
>
>                //FS: Casting WicketNotSerializableException with
> SimpleIdIncrementalFaultList(cayenne return class)
>                queryRows = new 
> ArrayList(MCApplication.getContext().performQuery(q));
> --------------
> I expected Cayenne to get all the IDs and the first 50 objects (1st page),
> however it seems it is fetching the 1004 objects. The log is the following:
>
>
> INFO  - QueryLogger                - --- will run 1 query.
> INFO  - QueryLogger                - --- transaction started.
> INFO  - QueryLogger                - SELECT t0.ProposalID FROM Proposal t0
> INFO  - QueryLogger                - === returned 1006 rows. - took 10 ms.
> INFO  - QueryLogger                - +++ transaction committed.
> INFO  - QueryLogger                - --- will run 1 query.
> INFO  - QueryLogger                - --- transaction started.
> INFO  - QueryLogger                - SELECT t0.ProposalID, t0.ProposalTS,
> t0.CompanyFK, t0 FROM Proposal t0 WHERE (t0.ProposalID = ?) OR
> (t0.ProposalID = ?)............... - prepared in 30 ms.
> INFO  - QueryLogger                - === returned 1006 rows. - took 130 ms.
> INFO  - QueryLogger                - +++ transaction committed.
>
> I'd appreciate if someone could help me out.
>
> Thanks
> Felix
>
> --
> View this message in context: 
> http://cayenne.195.n3.nabble.com/paginated-queries-setPageSize-tp2779985p2779985.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.



-- 
Andrey

Reply via email to