Re: How to query a relationship

From: Frank (farocc..otmail.com)
Date: Thu Feb 15 2007 - 09:48:45 EST

  • Next message: Michael Gentry: "Re: OutOfMemoryErrors (solved)"

    I traced this to the first table bsypemp has many records where the
    department # (emdep4) is 0
    So I think cayenne is trying to join these records to bprppcp and fails.

    By join is:
    bsypemp->emhsp# to brpppcp->pchsp#
    bsypemp->emdep4 to brpppcp->pcdep4

    dep4 is the department #

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

    > Well, the error message:
    >
    > No matching getter method found for property Pcldds on class
    > stemc.cayenne.as400.Bsypemp
    >
    > is indeed correct, because that property is in your Bprppcp class. I
    > didn't see anything else initially in your code that helped me
    > understand why you got that, but it is obvious that Cayenne is trying
    > to look at Bsypemp instead of Bprppcp for that value (and it is in
    > Bprppcp according to your code). You could try checking the model,
    > etc. If you need more help for relationships, there are several
    > documentation pages that talk about constructing them and I do a fair
    > number of them in the Cayenne In Motion example.
    >
    > /dev/mrg
    >
    >
    > On 2/14/07, Frank <farocc..otmail.com> wrote:
    >> Hello,
    >>
    >> I have as AS400 relationship defined between two tables.
    >> I need to include a column from the second table in my list.
    >>
    >> Here is my error:
    >> No matching getter method found for property Pcldds on class
    >> stemc.cayenne.as400.Bsypemp
    >>
    >> Thanks
    >> Frank
    >>
    >> Here is my query:
    >> Expression e = ExpressionFactory.matchDbExp
    >>
    >> (Bsypemp.EMHSPPOUND_PK_COLUMN, new Integer(1));
    >>
    >> e = e.andExp(ExpressionFactory.likeExp(Bsypemp.EMYLNM_PROPERTY, lname
    >>
    >> +"%"));
    >>
    >>
    >> SelectQuery query = new SelectQuery(Bsypemp.class,e);
    >>
    >> List records = context.performQuery(query);
    >>
    >> Here is my first table:
    >> package stemc.cayenne.as400.auto;
    >>
    >>
    >> /** Class _Bsypemp was generated by Cayenne.
    >>
    >> * It is probably a good idea to avoid changing this class manually,
    >>
    >> * since it may be overwritten next time code is regenerated.
    >>
    >> * If you need to make any customizations, please use subclass.
    >>
    >> */
    >>
    >> public class _Bsypemp extends org.objectstyle.cayenne.CayenneDataObject {
    >>
    >>
    >> public static final String E_MEMPPOUND_PROPERTY = "eMEMPpound";
    >>
    >> public static final String E_MHSPPOUND_PROPERTY = "eMHSPpound";
    >>
    >> public static final String E_MWPHPOUND_PROPERTY = "eMWPHpound";
    >>
    >> public static final String EMDEP4_PROPERTY = "emdep4";
    >>
    >> public static final String EMYFNM_PROPERTY = "emyfnm";
    >>
    >> public static final String EMYLNM_PROPERTY = "emylnm";
    >>
    >>
    >> public static final String EMEMPPOUND_PK_COLUMN = "EMEMP#";
    >>
    >> public static final String EMHSPPOUND_PK_COLUMN = "EMHSP#";
    >>
    >>
    >> public void setEMEMPpound(java.math.BigDecimal eMEMPpound) {
    >>
    >> writeProperty("eMEMPpound", eMEMPpound);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getEMEMPpound() {
    >>
    >> return (java.math.BigDecimal)readProperty("eMEMPpound");
    >>
    >> }
    >>
    >>
    >>
    >> public void setEMHSPpound(java.math.BigDecimal eMHSPpound) {
    >>
    >> writeProperty("eMHSPpound", eMHSPpound);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getEMHSPpound() {
    >>
    >> return (java.math.BigDecimal)readProperty("eMHSPpound");
    >>
    >> }
    >>
    >>
    >>
    >> public void setEMWPHpound(java.math.BigDecimal eMWPHpound) {
    >>
    >> writeProperty("eMWPHpound", eMWPHpound);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getEMWPHpound() {
    >>
    >> return (java.math.BigDecimal)readProperty("eMWPHpound");
    >>
    >> }
    >>
    >>
    >>
    >> public void setEmdep4(java.math.BigDecimal emdep4) {
    >>
    >> writeProperty("emdep4", emdep4);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getEmdep4() {
    >>
    >> return (java.math.BigDecimal)readProperty("emdep4");
    >>
    >> }
    >>
    >>
    >>
    >> public void setEmyfnm(String emyfnm) {
    >>
    >> writeProperty("emyfnm", emyfnm);
    >>
    >> }
    >>
    >> public String getEmyfnm() {
    >>
    >> return (String)readProperty("emyfnm");
    >>
    >> }
    >>
    >>
    >>
    >> public void setEmylnm(String emylnm) {
    >>
    >> writeProperty("emylnm", emylnm);
    >>
    >> }
    >>
    >> public String getEmylnm() {
    >>
    >> return (String)readProperty("emylnm");
    >>
    >> }
    >>
    >>
    >>
    >> }
    >>
    >> Here is my second table
    >>
    >> package stemc.cayenne.as400.auto;
    >>
    >>
    >> /** Class _Bprppcp was generated by Cayenne.
    >>
    >> * It is probably a good idea to avoid changing this class manually,
    >>
    >> * since it may be overwritten next time code is regenerated.
    >>
    >> * If you need to make any customizations, please use subclass.
    >>
    >> */
    >>
    >> public class _Bprppcp extends org.objectstyle.cayenne.CayenneDataObject {
    >>
    >>
    >> public static final String P_CHSPPOUND_PROPERTY = "pCHSPpound";
    >>
    >> public static final String PCDEP4_PROPERTY = "pcdep4";
    >>
    >> public static final String PCLDDS_PROPERTY = "pcldds";
    >>
    >>
    >> public static final String PCDEP4_PK_COLUMN = "PCDEP4";
    >>
    >> public static final String PCHSPPOUND_PK_COLUMN = "PCHSP#";
    >>
    >>
    >> public void setPCHSPpound(java.math.BigDecimal pCHSPpound) {
    >>
    >> writeProperty("pCHSPpound", pCHSPpound);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getPCHSPpound() {
    >>
    >> return (java.math.BigDecimal)readProperty("pCHSPpound");
    >>
    >> }
    >>
    >>
    >>
    >> public void setPcdep4(java.math.BigDecimal pcdep4) {
    >>
    >> writeProperty("pcdep4", pcdep4);
    >>
    >> }
    >>
    >> public java.math.BigDecimal getPcdep4() {
    >>
    >> return (java.math.BigDecimal)readProperty("pcdep4");
    >>
    >> }
    >>
    >>
    >>
    >> public void setPcldds(String pcldds) {
    >>
    >> writeProperty("pcldds", pcldds);
    >>
    >> }
    >>
    >> public String getPcldds() {
    >>
    >> return (String)readProperty("pcldds");
    >>
    >> }
    >>
    >>
    >>
    >> }
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 15 2007 - 09:49:25 EST