Hi Eric,

'performQuery' method will only return the first result set, no matter how many results you have in the query. To get all results, you will need to use a different method for select:

QueryResponse result = context.performGenericQuery(query);

Then you can scan vis the QueryResponse object and access individual result lists:

http://cayenne.apache.org/doc/api/org/apache/cayenne/QueryResponse.html

HTH
Andrus


On Aug 19, 2008, at 5:21 PM, Eric Polino wrote:

I need to run a group of select queries all at once and would like to
parallelize it.  I'm attempting to do it with QueryChain but I'm
having issues getting the data I'm querying.  I know that QueryChain
will always return DataRows, but it seems as though I only get the
first query's result back and not all of them.  I'm using this page
from the guide as my starting point.
http://cayenne.apache.org/doc/querychain.html

QueryChain query = new QueryChain();

query.addQuery(new SQLTemplate(TypeFoo.class, "select count(*) as foo1
from TypeFoo"));
query.addQuery(new SQLTemplate(TypeBar.class, "select count(*) as foo2
from TypeBar"));
query.addQuery(new SQLTemplate(Type.class, "select count(*) as foo3
from Type"));

List<DataRow> ret = getDataContext().performQuery(query);
DataRow dr = ret.get(0);

System.out.println(ret.size()); //  "1"
System.out.println(dr.keySet().size());  //  "1"
System.out.println("FOO1 " + dr.get("FOO1")); //  "FOO1 123"
System.out.println("FOO2 " + dr.get("FOO2")); //  "FOO2 null"
System.out.println("FOO3 " + dr.get("FOO3")); //  "FOO3 null"

TIA,
Eric


--
Eric Polino
Campground Automated Systems


Reply via email to