Hi Tore,
Thanks for reporting this issue. I just opened a ticket for further
investigation:
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-105
Andrus
On Mar 9, 2004, at 4:47 AM, Tore Halset wrote:
> Hello.
>
> I tried to upgrade from 1.0.6 to 1.1M4 in our main application now.
> Prefetching does not seem to work..
>
> One example. We have a table called "cell" with "cell_id" (char(8)) as
> primary key. Another table is called cell_coverage and has a compound
> primary key that consist of "cell_id" (char(8)), "area" (int) and
> "coord_id" (decimal). There is a one-to-many relalationship between
> cell and coverage.
>
> The code:
> SelectQuery q = new SelectQuery(Cell.class);
> // does not work after upgrade to cayenne-1.1M4 :(
> q.addPrefetch("cellCoverages");
> dataContext.performQuery(q);
>
>
> This is the output for a query on cell with prefetch on cell_coverage.
> 10:36:20,962 INFO [QueryLogger] --- will run 2 queries.
> 10:36:20,963 INFO [QueryLogger] --- transaction started.
> 10:36:21,028 INFO [QueryLogger] SELECT t0.CELL_ID, ...<other
> fields>... FROM CELL t0 - prepared in 50 ms.
> 10:36:22,187 INFO [QueryLogger] === returned 1631 rows. - took 1222
> ms.
> 10:36:22,201 INFO [QueryLogger] SELECT t0.AREA, t0.COORD_ID,
> t0.LATITUDE, t0.LONGITUDE, t0.CELL_ID FROM CELL_COVERAGE t0 - prepared
> in 12 ms.
> 10:36:23,880 INFO [QueryLogger] === returned 15877 rows. - took 1692
> ms.
>
> That looks correct for me. Every cell_coverage should be in the cache
> and nothing should be a fault.
>
> The problem is that when I loop the cells to print out the coverages
> cayenne-1.1M4 fetches the coverages once more. This will currently
> leed to 15877 extra roundtrips to the database...
>
> 10:36:28,109 INFO [QueryLogger] --- will run 1 query.
> 10:36:28,111 INFO [QueryLogger] --- transaction started.
> 10:36:28,113 INFO [QueryLogger] SELECT t0.AREA, t0.COORD_ID,
> t0.LATITUDE, t0.LONGITUDE, t0.CELL_ID FROM CELL_COVERAGE t0 WHERE
> (t0.COORD_ID = ?) AND (t0.AREA = ?) AND (RTRIM(t0.CELL_ID) = ?) [bind:
> 17210, 0, 'XX121212']
> 10:36:28,175 INFO [QueryLogger] === returned 1 row. - took 63 ms.
>
> This did not happen before I upgraded from cayenne-1.0.6 to
> cayenne-1.1M4.
>
> - Tore.
This archive was generated by hypermail 2.0.0 : Tue Mar 09 2004 - 10:49:02 EST