Re: How to query a relationship

From: Frank (farocc..otmail.com)
Date: Thu Feb 15 2007 - 10:11:12 EST

  • Next message: Pogs: "AUTO_PK_SUPPORT Error"

    Here is my original query string:

    String sql = "SELECT 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)";

    sql += " AND EMYLNM like ?";

    sql += " AND EMYFNM like ?";

    sql += " ORDER BY EMYLNM";

    Thanks

    Frank

    ----- Original Message -----
    From: "Michael Gentry" <blacknex..mail.com>
    To: <use..ayenne.apache.org>
    Sent: Thursday, February 15, 2007 10:06 AM
    Subject: Re: How to query a relationship

    > When you were using JDBC, did you have something like a right outer
    > join? (An optional relationship?)
    >
    > /dev/mrg
    >
    >
    > On 2/15/07, Frank <farocc..otmail.com> wrote:
    >> Hi Michael,
    >>
    >> I looked at your tutorial in motion, (it has hellped me understand
    >> cayenne
    >> better)
    >> and have tried setting one to many on the department table.
    >>
    >> It still fails trying to query department # = 0 and hsp#=5
    >> because there is no match in th erelated table.
    >>
    >> Should I just filter out records where department # is 0?
    >> I did not have this problem when I did a jdbc join prior to using
    >> cayenne.
    >>
    >> I am kinda lost at how to resolve this.
    >>
    >> Regards,
    >>
    >> Frank
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 15 2007 - 10:11:53 EST