Group function support

From: Dave Lamy (davelam..mail.com)
Date: Tue Jun 09 2009 - 17:14:22 EDT

  • Next message: Andrus Adamchik: "Re: Group function support"

    Hey guys-- I'm trying to get group functions operational in my
    Cayenne-backed system. As far as I can tell, the only support for group
    functions (min, max, count, etc) outside of rolling my own SQL is EJBQL.. is
    that true or am I missing something?

    Assuming this is the case: I'm having issues with my EJBQL working when I
    reference a generic Cayenne class. IE, my "Artist" data class doesn't have
    a strong class implementation.. it just uses a standard base class. This
    feature has been great and is absolutely essential to our software.
    However, in my test case I have a simple Artist class with no concrete impl:

    <obj-entity name="Artist" lock-type="optimistic" dbEntityName="ARTIST"
    superClassName="com.routeto1.data.DynamicDataObject">
            <obj-attribute name="address" type="java.lang.String"
    db-attribute-path="ADDRESS"/>
            <obj-attribute name="name" type="java.lang.String"
    db-attribute-path="NAME"/>
            <obj-attribute name="type" type="java.lang.String"
    db-attribute-path="TYPE"/>
     </obj-entity>

     when I try to execute a simple EJBQL group test query:

    select count(a), a.name from Artist a group by a.name

    I get the following exception:

    org.apache.cayenne.CayenneRuntimeException: [v.3.0M5 Nov 29 2008 21:12:47]
    Can't perform lookup. There is more than one ObjEntity mapped to
    com.routeto1.data.impl.DynamicDataObject
        at
    org.apache.cayenne.map.EntityResolver._lookupObjEntity(EntityResolver.java:847)
        at
    org.apache.cayenne.map.EntityResolver.lookupObjEntity(EntityResolver.java:701)
        at
    org.apache.cayenne.query.BaseQueryMetadata.resolve(BaseQueryMetadata.java:99)
        at
    org.apache.cayenne.query.SQLTemplateMetadata.resolve(SQLTemplateMetadata.java:47)
        at
    org.apache.cayenne.query.SQLTemplate.getMetaData(SQLTemplate.java:157)
        at
    org.apache.cayenne.access.jdbc.SQLTemplateAction.<init>(SQLTemplateAction.java:77)
        at
    org.apache.cayenne.dba.JdbcActionBuilder.sqlAction(JdbcActionBuilder.java:90)
        at
    org.apache.cayenne.access.jdbc.EJBQLAction.performAction(EJBQLAction.java:100)
        at
    org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
        at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)
        at
    org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:423)
        at
    org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:67)
        ....

    which seems to read like the EJBQL impl doesn't support the generic base
    class concept. Am I right on this? I don't care about EJBQL, just want to
    get group functions working without having to resort to rolling a bunch of
    dynamic SQL :-). Perhaps an upgrade to M6 is in order? Thanks in advance
    for any help you can provide!

    --Dave Lamy



    This archive was generated by hypermail 2.0.0 : Tue Jun 09 2009 - 17:21:49 EDT