QueryChain

From: Eric Polino (eri..ampgroundautomation.com)
Date: Tue Aug 19 2008 - 10:21:48 EDT

  • Next message: John Armstrong: "Re: PK ID retrieval code generation seems to fail"

    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
    



    This archive was generated by hypermail 2.0.0 : Tue Aug 19 2008 - 10:22:22 EDT