Looking at the code, there is a condition on which resolving the first
page in of the returned IncrementalFaultList is deferred until it is
being accessed... And sure enough this condition is the presence of
prefetches... So what happens when you actually access an object in the
list (e.g. list.get(0))?
Andrus
On Oct 27, 2004, at 9:39 PM, Derek Rendall wrote:
>>> I noticed that prefetching doesnt work for paginated queries. I guess
>>> this makes sense - I cant think how to get it going nicely.
>
>> It supposed to work actually. What exactly happens in your case when
>> you are trying to do the prefetch?
>
> I have tried on inherited and non inherited objects (with the same
> result). With no page size set, I get the select for the main object,
> and a select for the prefetch relationship. With a pagesize set then I
> only see the select for the main object - not the relationship that
> supposed to be prefetched.
>
> The following code (tries a select with page size followed by one
> without):
>
> Expression exp = ExpressionFactory.matchExp("description",
> aee.getDescription());
> SelectQuery query = new SelectQuery(AccountingEventError.class,
> exp);
> query.addPrefetch("accountingEventErrorDetailArray");
> query.setPageSize(10);
> List list = getDataContext().performQuery(query);
>
> System.out.println("break");
>
> query = new SelectQuery(AccountingEventError.class, exp);
> query.addPrefetch("accountingEventErrorDetailArray");
> list = getDataContext().performQuery(query);
>
>
> results in the following output (some select fields removed for
> clarity):
>
> INFO QueryLogger: --- will run 1 query.
> INFO QueryLogger: SELECT t0.DESCRIPTION, ... , t0.ACCT_EVENT_ERROR_ID
> FROM DBA.ACCOUNTINGEVENTERROR t0 WHERE t0.DESCRIPTION = ? [bind: 'Test
> Description 6000'] - prepared in 10 ms.
> INFO QueryLogger: === returned 1 row. - took 40 ms.
> break
> INFO QueryLogger: --- will run 2 queries.
> INFO QueryLogger: --- transaction started.
> INFO QueryLogger: SELECT t0.DESCRIPTION, ... , t0.ACCT_EVENT_ERROR_ID
> FROM DBA.ACCOUNTINGEVENTERROR t0 WHERE t0.DESCRIPTION = ? [bind: 'Test
> Description 6000']
> INFO QueryLogger: === returned 1 row. - took 10 ms.
> INFO QueryLogger: SELECT t0.DETAILS, ... , t0.ACCT_EVENT_ERROR_ID,
> t0.DETAIL_NUMBER FROM DBA.ACCOUNTINGEVENTERRORDETAIL t0,
> DBA.ACCOUNTINGEVENTERROR t1 WHERE t0.ACCT_EVENT_ERROR_ID =
> t1.ACCT_EVENT_ERROR_ID AND (t1.DESCRIPTION = ?) [bind: 'Test
> Description 6000']
> INFO QueryLogger: === returned 1 row. - took 10 ms.
> INFO QueryLogger: +++ transaction committed.
>
> Thanks
>
> Derek
>
This archive was generated by hypermail 2.0.0 : Wed Oct 27 2004 - 22:46:37 EDT