cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Razumovsky <razumovsky.and...@gmail.com>
Subject Re: Faulting Behavior with setPageSize() and Sort Ordering
Date Tue, 16 Jun 2009 17:45:01 GMT
The trick of paginated query is that all objects returned are HOLLOW, thus
having only identifier. Ordering.orderList will surely resolve *all*
records, how else would it know parameters of each object. To order a long
list properly you need to set ordering to a query:

query.setPageSize(RowsPerPage);
query.addOrdering(order);
List orderedResults = context.performQuery(query);

2009/6/16 Joe Baldwin <jfbaldwin@earthlink.net>

> This is a question concerning making performance enhancements with Cayenne
> directives.
>
> Lets say you use the following SelectQuery method
>
>        query.setPageSize(RowsPerPage);
>
> But then you decide to sort order the result list using
>
>        Ordering order = new Ordering(<entity>.<attribute>_PROPERTY, true);
>        order.orderList(resultList);
>
> If I understand the docs, then the purpose of setting the PageSize
> parameter is to reduce the work load (and increase performance) by limiting
> fetching to the first "RowsPerPage" amount of data-objects.
>
> I am wondering whether performing a sort ordering on the resultList
> triggers *all* the page and object faults.  If I am correct then sort
> ordering would render setPageSize moot in this scenario.
>
> Is my analysis correct or has Cayenne somehow avoided this?  (Or is there
> another way to do sort ordering?)
>
> Joe
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message