Re: Aggregate in a Qualifier

From: Joshua Pyle (joshua.t.pyl..mail.com)
Date: Tue Feb 15 2005 - 12:30:53 EST

  • Next message: Andrus Adamchik: "Re: Multiple DataNodes"

    Awesome. This is excactly what I needed.

    Thanks,

    -- 
    Joshua T. Pyle
    Go has always existed.
    

    On Tue, 15 Feb 2005 07:23:32 -0500 (EST), Andrus Adamchik <andru..bjectstyle.org> wrote: > I guess support for such qualifiers would be a nice thing to have. > Improving aggregated data handling is definitely on the list. > > However SQLTemplate (especially mapped in the Modeler) is a very simple > and powerful alternative. Of course you don't have to hardcode the schema. > You can make it a SQLTemplate parameter. E.g.: > > SELECT... FROM $schema.MY_TABLE1 t1, $schema.MY_TABLE2 t2 ... > > So "schema" becomes one of the dynamic template parameters. To find the > schema in the code you need to get a hold of one of the DbEntities that > uses schema in question: > > DbEntity entity = > dataContext.getEntityResolver().lookupDbEntity(Maildata.class); > > from here you can either do this: > > String schema = entity.getSchema(); > > or get a default schema for the whole DataMap (if you set one): > > String schema = entity.getDataMap().getDefaultSchema(); > > Andrus > > > > I was hoping the following would be possible in Cayenne... > > > > Expression where = Expression.fromString(Maildata.WHEN_SENT_PROPERTY + " > > is null and " + Maildata.MAIL_ACTIONS_ARRAY_PROPERTY + ".size < 4 "); > > SelectQuery query = new SelectQuery(Maildata.class); > > query.setQualifier(where); > > > > After ruunning my first test is was obvious that this is not possible > > :-) > > > > I was trying to avoid using the SQLTemplate due to the fact that I don't > > want to hard code the schema name for the tables in the java code. > > > > 1. Is there any way to do something like a COUNT on a relationship in > > the Qualifier for a query? > > > > 2. If no on 1 then is there a way I can get the schema name from the > > mappings? And perhaps how? > > > > Thanks in advance, > > > > Joshua T. Pyle > > Go has always existed. > >



    This archive was generated by hypermail 2.0.0 : Tue Feb 15 2005 - 12:30:56 EST