Re: Getting complex queries in cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed May 11 2005 - 10:54:44 EDT

  • Next message: Mike Kienenberger: "Re: superclass template question"

    On May 11, 2005, at 10:29 AM, Sami Mohammed wrote:

    > is there any way that i can call object entity in jsp using
    > SQLTemplate instead of Table field

    Yes. A simple way - use SelectQuery instead of SQLTemplate. A more
    involved way - make sure your result includes *all* columns that a
    SelectQuery for that type of object includes, and also that they have
    the same names as DbAttributes for the underlying entity. In the later
    case Cayenne will be able to create a DataObject. Your earlier example
    is missing some columns defined in EDW_DATA_MGMT_SECURITY_USR (such as
    ACTV_FLAG, etc.), and as a result a valid object can't be created:

    > "select"
    > + " #result('u.USR_ID' 'String'),"
    > + " #result('u.LAST_NAME' 'String'),"
    > + " #result('t.SECURITY_SHORT_DESC' 'String'),"
    > + " #result('u.LAST_LOGIN_DATE' 'java.util.Date')"
    > + " from IHA.EDW_DATA_MGMT_SECURITY_MSTR t,"
    > + "IHA.EDW_DATA_MGMT_SECURITY_USR u"
    > + " where t.security_mstr_key=u.security_mstr_key"

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed May 11 2005 - 10:54:46 EDT