cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Pikkemaat <h.pikkem...@tsi-solutions.nl>
Subject complex query vs performIteratedQuery vs Prefetching
Date Tue, 10 Nov 2009 12:47:36 GMT
Hi,

My case:

I have a complex query which returns a huge amount of data. It returns 
data from
two tables which are joined.

Because the amount of data is huge I cannot load all of it into memory.
For this reason I want to use an iterated query.

I also want to prevent cayenne from executing a query for each detail record
so I want to use prefetching.

What I tried:

    - I'm using cayenne 2.0.4.
    - I use SQLTemplate to instantiate the query.
    - I set the page size to 1000 to prevent loading the whole db 
(required for postgres)
    - I use performIteratedQuery to run the query.
    - As I get DataRows back from the iterated query I use 
dataContext.objectFromDataRow(..) to create my objects

The Problem:

    The relation is not automatically setup. This means that for every 
record I access the detail table a query is executed.

My Questions:

    - How should I use prefetching in combination with SQLTemplate and 
an iterated query which returns DataRows?
    -  Is there a way to manually setup this relationship (without 
changing the state of the parent object?)
    -  Is there another way to do what I want using Cayenne?

Mime
View raw message