Re: how to call a custom query

From: Frank (farocc..otmail.com)
Date: Thu Feb 01 2007 - 21:41:29 EST

  • Next message: Michael Gentry: "Re: how to call a custom query"

    Here is my code.
    My table show no data. I have three records for this query.

    I am trying to display procedure_name, provider_name, office_phone,
    alt_phone
    The _Schedules class does not have these fields.
    What do I need to do?

    Thanks
    Frank
    public List getRecords() {

    String query = "SELECT ALL schedules.schedule_id,schedules.schedule_date,";

    query += " procedures.procedure_name,providers.provider_name,";

    query += " providers.office_phone,providers.alt_phone";

    query += " FROM schedules";

    query += " INNER JOIN procedures ON schedules.procedure_id =
    procedures.procedure_id";

    query += " INNER JOIN providers ON schedules.provider_id =
    providers.provider_id";

    query += " WHERE schedule_date = CURDATE()";

    query += " ORDER BY procedure_name";

    DataContext context = DataContext.getThreadDataContext();

    SQLTemplate rawSelect = new SQLTemplate(Schedules.class, query);

    List records = context.performQuery(rawSelect);

    return records;

    }

    ----- Original Message -----
    From: "Christian Mittendorf" <christian.mittendor..reenet.de>
    To: <use..ayenne.apache.org>
    Sent: Thursday, February 01, 2007 7:16 PM
    Subject: Re: how to call a custom query

    > Please check out the documentation at the great new Cayenne homepage:
    >
    > http://cayenne.apache.org/doc20/queries.html
    >
    > ...especially the part on SQLTemplates
    >
    > Christian
    >
    > P.S. The link to the API (http://cayenne.apache.org/1_2/api/cayenne/
    > org/objectstyle/cayenne/query/package-summary.html) from the 1.2
    > documentation returns a 404 error....
    >
    >
    > Am 02.02.2007 um 01:02 schrieb Frank:
    >
    >> Can anyone help me with the a short example on how to do this?
    >>
    >> Thanks
    >>
    >> Frank
    >> ----- Original Message ----- From: "Frank" <farocc..otmail.com>
    >> To: <use..ayenne.apache.org>
    >> Sent: Thursday, February 01, 2007 11:33 AM
    >> Subject: how to call a custom query
    >>
    >>
    >>> Hello,
    >>>
    >>> I have the following raw query defined.
    >>> SELECT BSYDTAA.BSYPEMP.EMHSP#, BSYDTAA.BSYPEMP.EMYLNM,
    >>> BSYDTAA.BSYPEMP.EMYFNM, BSYDTAC.BPRPPCP.PCDEP4, BSYDTAC.BPRPPCP.PCLDDS,
    >>> BSYDTAA.BSYPEMP.EMEMP# AS EMEMP, BSYDTAA.BSYPEMP.EMWPH# AS WPHONE FROM
    >>> BSYDTAA.BSYPEMP, BSYDTAC.BPRPPCP WHERE BSYDTAA.BSYPEMP.EMHSP# =
    >>> BSYDTAC.BPRPPCP.PCHSP# AND BSYDTAA.BSYPEMP.EMDEP4 =
    >>> BSYDTAC.BPRPPCP.PCDEP4 AND (BSYDTAA.BSYPEMP.EMHSP# IN (1,5)) AND
    >>> (BSYDTAA.BSYPEMP.EMDOT=0)
    >>> AND EMEMP# = ?
    >>>
    >>> How do I call this from code using the SelectQuery and passing in the
    >>> value?
    >>>
    >>> Thanks
    >>>
    >>> Frank
    >>>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 01 2007 - 21:42:15 EST