openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Srinivasa Segu" <ss...@bea.com>
Subject PagingResultObjectProvider page size and FetchBatchSize
Date Fri, 16 Mar 2007 22:31:51 GMT
The PagingResultObjectProvider during initialization does checks to
determine the appropriate pageSize. While this logic caps the size to 50
and addresses determining an appropriate page size, it doesn't always
conform to the set batch size. For example with the size being 1000 and
FetchBatchSize set to say 500, the page size is determined to be 50
resulting in eager selects happening in batches of 50 when the user
expects it to be in batches of 500. If there are no objections planning
to modify this piece to honor/use the batch size, attached the initial
diff. 

 

Current code:

// try to find a good page size.  if the known size < batch size, use

// it.  if the batch size is set, then use that; if it's sorta close

// to the size, then use the size / 2 to get two full pages rather

// than a possible big one and small one.  cap everything at 50.

int batch = getFetchConfiguration().getFetchBatchSize();

int pageSize;

if (size <= batch && size <= 50)

    pageSize = (int) size;

else if (batch > 0 && batch <= 50) {

    if (size <= batch * 2) {

        if (size % 2 == 0)

            pageSize = (int) (size / 2);

        else

            pageSize = (int) (size / 2 + 1);

    } else

        pageSize = batch;

} else if (size <= 50)

    pageSize = (int) size;

else if (size <= 100) {

    if (size % 2 == 0)

        pageSize = (int) (size / 2);

    else

        pageSize = (int) (size / 2 + 1);

} else

    pageSize = 50;

 

- Srinivasa


Mime
View raw message