Re: Problems with MAX

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jan 28 2006 - 15:08:48 EST

  • Next message: Andrus Adamchik: "Re: Mixing object and id-based access in a single transaction"

    > Is there any posibility to use the MAX-Function?

    Yes, and you are on the right track with SQLTemplate. You just need
    to make sure that query includes ALL columns from the "rights" DbEntity.

    Andrus

    On Jan 28, 2006, at 1:49 PM, Chronos wrote:

    > Hey!
    >
    > I need your help:
    >
    > SQLTemplate rawSelect = new SQLTemplate(Rights.class, "SELECT id,
    > MAX(r)
    > AS r, MAX(e) AS e, MAX(d) AS d, MAX(c) AS c FROM rights WHERE
    > document_id=220 AND group_id=1 GROUP BY group_id", true);
    > rawSelect.setFetchLimit(fetchlimit);
    > rawSelect.setFetchingDataRows(true);
    > List grpIds = ctxt.performQuery(rawSelect);
    >
    > If I use "rawSelect.setFetchingDataRows(true)" the result is correct,
    > but if I use objectstyle, the result is empty.
    >
    > Result of 1:
    > org.objectstyle.cayenne.DataRo..922221[version=-9223372036854775806,
    > replaces=-9223372036854775808, values={d=true, r=true, c=false,
    > id=222,
    > e=true}]
    >
    > Result of 2:
    > {[]<oid: <ObjectId:Rights, id=222>; state: hollow>}
    >
    > Is there any posibility to use the MAX-Function?
    >
    > Thanks
    >
    > PK
    >



    This archive was generated by hypermail 2.0.0 : Sat Jan 28 2006 - 15:08:51 EST