Re: Getting complex queries in cayenne

From: Cris Daniluk (cris.danilu..mail.com)
Date: Thu May 05 2005 - 23:12:10 EDT

  • Next message: Cris Daniluk: "Re: unit testing Cayenne objects"

    > Aggregate queries are always a stretch with ORM, so instead of
    > inventing our own SQL dialect to do them, a "preferred" Cayenne
    > solution is to a use SQLTemplate query.
    ...
    > > We need to be able to aggregate the cashflows by month, quarter and
    > > year.
    > >

    Aggregate queries are one of those situations where its generally
    better if ORM doesn't provide the solution anyway. From the
    description of what you are trying to do, it sounds like this problem
    is a key part of your domain, and so its probably best to be
    expressive through code. If you did it in SQL or even via some ORM
    construct, you would still ultimately be disguising this very
    important facet of your application. The best part is, unless you are
    talking about millions of rows, you are not likely to ever notice the
    speed impact.

    And if you do notice, go ahead and use a SQLTemplate with raw SQL...
    after all, by definition, optimizations are a "break" in the
    architecture anyway. There's nothing shameful about it...

    Cris



    This archive was generated by hypermail 2.0.0 : Thu May 05 2005 - 23:12:11 EDT