aggregate queries

From: dan17..elus.net
Date: Fri Jun 11 2004 - 13:13:01 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne and Hibernate by Bill Dudney"

    I'm using Cayenne in my application and I need to do an aggregate query on my
    database. For example, I need a query to do this:

    select b.year, b.month, sum(b.value1), sum(b.value2)
    from entity a, entity_data b
    where (a.entity_id = b.entity_id) and (a.entity_group_id = 1234)
    group by b.year, b.month

    entity, and entity_data both map to cayenne objects. I could fetch all the
    objects from entity_data and then add them up, but that puts the work on the
    object layer and takes too long.

    How do I make Cayenne do something similar, but keep the processing in the
    database layer for speed?

    - Dan



    This archive was generated by hypermail 2.0.0 : Fri Jun 11 2004 - 13:13:02 EDT