You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Frank <fa...@hotmail.com> on 2007/02/13 17:37:03 UTC

How do you deal with AS400 schemas

Hello,
Cayenne is generating code that has # because our AS400 database tables use 
these as field names.
Severity and Description Path Resource Location Creation Time Id
Syntax error on token "Invalid Character", , expected 
jcdsurvey/src/stemc/cayenne/as400/auto _Bsypemp.java line 199 1171384311117 
13668

public static final String EMEMP#_PK_COLUMN = "EMEMP#";
public static final String EMHSP#_PK_COLUMN = "EMHSP#";

Should I just use a Raw Sql?
I had to remove the # from the objEntity as Cayenne complained.

Thanks

Frank 


Re: OutOfMemoryErrors (solved)

Posted by Michael Gentry <bl...@gmail.com>.
That's still a lot of records to return from a query, but sometimes
you need that, too.  Increasing the memory is probably appropriate,
then.

/dev/mrg


On 2/15/07, Frank <fa...@hotmail.com> wrote:
> My query returned less than 2700 records.
> My schema was large, about 190 fields.
>
> I trimmed this down to about 5 and increased the JVM.
>
> Regards,
>
> Frank
> ----- Original Message -----
> From: "Michael Gentry" <bl...@gmail.com>
> To: <us...@cayenne.apache.org>
> Sent: Thursday, February 15, 2007 9:27 AM
> Subject: Re: OutOfMemoryErrors (solved)
>
>
> > Bumping the heap size up is probably fine, but I also suspect Frank
> > might be trying to read in too much data given his previous postings
> > using LIKE expressions.  He may be getting back tens of thousands of
> > rows, if not more.  Perhaps his application requires that, though.
> >
> > /dev/mrg
> >
> >
> > On 2/15/07, Andrus Adamchik <an...@objectstyle.org> wrote:
> >> You are being too picky. Why is this not a solution? Default 64m heap
> >> size for the JVM is not enough for most applications nowadays ;-)
> >>
> >> Andrus
> >>
> >>
> >> On Feb 15, 2007, at 2:47 AM, Juergen Saar wrote:
> >>
> >> > This is a workaround, but not a solution ...
> >> >
> >> > -sorry-
> >> > --- Juregen ---
> >> >
> >> > 2007/2/14, Frank <fa...@hotmail.com>:
> >> >>
> >> >> Hi Andrus,
> >> >>
> >> >> I bumped the JVM up to 512m
> >> >> This resolved my issue.
> >> >> I also removed AS400 fields not needed in my query to help reduce
> >> >> memory
> >> >> requirements.
> >> >>
> >> >> Regards,
> >> >>
> >> >> Frank
> >> >>
> >> >>
> >>
> >>
> >
>

Re: How to query a relationship

Posted by Frank <fa...@hotmail.com>.
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" <bl...@gmail.com>
To: <us...@cayenne.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 <fa...@hotmail.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
>>
>>
> 


Re: How to query a relationship

Posted by Michael Gentry <bl...@gmail.com>.
When you were using JDBC, did you have something like a right outer
join?  (An optional relationship?)

/dev/mrg


On 2/15/07, Frank <fa...@hotmail.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
>
>

Re: OutOfMemoryErrors (solved)

Posted by Frank <fa...@hotmail.com>.
My query returned less than 2700 records.
My schema was large, about 190 fields.

I trimmed this down to about 5 and increased the JVM.

Regards,

Frank
----- Original Message ----- 
From: "Michael Gentry" <bl...@gmail.com>
To: <us...@cayenne.apache.org>
Sent: Thursday, February 15, 2007 9:27 AM
Subject: Re: OutOfMemoryErrors (solved)


> Bumping the heap size up is probably fine, but I also suspect Frank
> might be trying to read in too much data given his previous postings
> using LIKE expressions.  He may be getting back tens of thousands of
> rows, if not more.  Perhaps his application requires that, though.
> 
> /dev/mrg
> 
> 
> On 2/15/07, Andrus Adamchik <an...@objectstyle.org> wrote:
>> You are being too picky. Why is this not a solution? Default 64m heap
>> size for the JVM is not enough for most applications nowadays ;-)
>>
>> Andrus
>>
>>
>> On Feb 15, 2007, at 2:47 AM, Juergen Saar wrote:
>>
>> > This is a workaround, but not a solution ...
>> >
>> > -sorry-
>> > --- Juregen ---
>> >
>> > 2007/2/14, Frank <fa...@hotmail.com>:
>> >>
>> >> Hi Andrus,
>> >>
>> >> I bumped the JVM up to 512m
>> >> This resolved my issue.
>> >> I also removed AS400 fields not needed in my query to help reduce
>> >> memory
>> >> requirements.
>> >>
>> >> Regards,
>> >>
>> >> Frank
>> >>
>> >>
>>
>>
>

Re: OutOfMemoryErrors (solved)

Posted by Michael Gentry <bl...@gmail.com>.
Bumping the heap size up is probably fine, but I also suspect Frank
might be trying to read in too much data given his previous postings
using LIKE expressions.  He may be getting back tens of thousands of
rows, if not more.  Perhaps his application requires that, though.

/dev/mrg


On 2/15/07, Andrus Adamchik <an...@objectstyle.org> wrote:
> You are being too picky. Why is this not a solution? Default 64m heap
> size for the JVM is not enough for most applications nowadays ;-)
>
> Andrus
>
>
> On Feb 15, 2007, at 2:47 AM, Juergen Saar wrote:
>
> > This is a workaround, but not a solution ...
> >
> > -sorry-
> > --- Juregen ---
> >
> > 2007/2/14, Frank <fa...@hotmail.com>:
> >>
> >> Hi Andrus,
> >>
> >> I bumped the JVM up to 512m
> >> This resolved my issue.
> >> I also removed AS400 fields not needed in my query to help reduce
> >> memory
> >> requirements.
> >>
> >> Regards,
> >>
> >> Frank
> >>
> >>
>
>

Re: OutOfMemoryErrors (solved)

Posted by Andrus Adamchik <an...@objectstyle.org>.
You are being too picky. Why is this not a solution? Default 64m heap  
size for the JVM is not enough for most applications nowadays ;-)

Andrus


On Feb 15, 2007, at 2:47 AM, Juergen Saar wrote:

> This is a workaround, but not a solution ...
>
> -sorry-
> --- Juregen ---
>
> 2007/2/14, Frank <fa...@hotmail.com>:
>>
>> Hi Andrus,
>>
>> I bumped the JVM up to 512m
>> This resolved my issue.
>> I also removed AS400 fields not needed in my query to help reduce  
>> memory
>> requirements.
>>
>> Regards,
>>
>> Frank
>>
>>


Re: OutOfMemoryErrors (solved)

Posted by Juergen Saar <ju...@jsaar.org>.
This is a workaround, but not a solution ...

-sorry-
--- Juregen ---

2007/2/14, Frank <fa...@hotmail.com>:
>
> Hi Andrus,
>
> I bumped the JVM up to 512m
> This resolved my issue.
> I also removed AS400 fields not needed in my query to help reduce memory
> requirements.
>
> Regards,
>
> Frank
>
>

Re: How to query a relationship

Posted by Frank <fa...@hotmail.com>.
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 


Re: How to query a relationship

Posted by Frank <fa...@hotmail.com>.
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" <bl...@gmail.com>
To: <us...@cayenne.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 <fa...@hotmail.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");
>>
>> }
>>
>>
>>
>> }
>>
>>
> 


Re: How to query a relationship

Posted by Michael Gentry <bl...@gmail.com>.
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 <fa...@hotmail.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");
>
> }
>
>
>
> }
>
>

Re: How do I retrieve a record with two fields for PK

Posted by Juergen Saar <ju...@jsaar.org>.
*** RTFM ***

*objectForPK<file:///home/saar/docs/cayenne_1.1/api/cayenne/org/objectstyle/cayenne/DataObjectUtils.html#objectForPK%28org.objectstyle.cayenne.access.DataContext,%20java.lang.Class,%20java.util.Map%29>
*(DataContext<file:///home/saar/docs/cayenne_1.1/api/cayenne/org/objectstyle/cayenne/access/DataContext.html>
context,
java.lang.Class dataObjectClass, java.util.Map pk)


2007/2/14, Frank <fa...@hotmail.com>:
>
> Hello,
>
> I have this defined:
> DataContext context = DataContext.getThreadDataContext();
> Bsypemp emp = null;
> emp = (Bsypemp) DataObjectUtils.objectForPK(context, Bsypemp.class, id);
>
> my problem is that the PK consists of two fields EMHSP# & EMEMP
>
> What is the correct syntax for getting a record?
>
> Thanks
>
> Frank
>

How to query a relationship

Posted by Frank <fa...@hotmail.com>.
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");

}



}


Re: OutOfMemoryErrors

Posted by Frank <fa...@hotmail.com>.
I used your expression to locate records.
It returned
returned 2684 rows. - took 2880 ms.

which caused an OutOfMemory error. Java heap space.

I'll check on the suggestions you made.

Thanks

Frank

----- Original Message ----- 
From: "Andrus Adamchik" <an...@objectstyle.org>
To: <us...@cayenne.apache.org>
Sent: Wednesday, February 14, 2007 9:57 AM
Subject: OutOfMemoryErrors


> Frank,
> 
> thanks for confirming the fix. Also please send a message with a  
> different subject whenever you start a new topic (I changed the reply  
> subject to reflect the changing topic).
> 
> Now, OutOfMemoryErrors... There are two ways to address them:
> 
> 1. increase the available heap size:
> 
> http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/10/0098.html
> 
> 2. use less memory. i.e. check how many objects your queries return.  
> If it is in the tens or hundreds of thousands you may need to think  
> of redesigning your app or use result iterator, or paginated queries,  
> whichever is more appropriate in your case:
> 
> http://cayenne.apache.org/doc/iterating-through-data-rows.html
> http://cayenne.apache.org/doc/paginated-queries.html
> 
> Andrus
> 
> 
> On Feb 14, 2007, at 9:34 AM, Frank wrote:
>> Hi Andrus,
>>
>> I regenerated the code and eclipse does not complain about source  
>> errors.
>> I am still having problems, but since I am new to Cayenne, it just  
>> may be a coding issue:
>> When I attempt to retrieve some records, I get this error:
>>
>> javax.servlet.ServletException: Servlet execution threw an exception
>> net.sf.click.extras.cayenne.DataContextFilter.doFilter 
>> (DataContextFilter.java:125)java.lang.OutOfMemoryError: Java heap  
>> spaceHere is my code:private List filterEmployees(String lname,  
>> String fname) {     DataContext context =  
>> DataContext.getThreadDataContext();     Expression qualifier1  
>> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYFNM_PROPERTY,fname 
>> +"%");     Expression qualifier2  
>> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYLNM_PROPERTY,lname 
>> +"%");     SelectQuery query = new SelectQuery 
>> (Bsypemp.class,qualifier2);     List records = context.performQuery 
>> (query);     return records;    }ThanksFrank
> 
>

Re: OutOfMemoryErrors

Posted by Frank <fa...@hotmail.com>.
ok, thanks you

Frank
----- Original Message ----- 
From: "Andrus Adamchik" <an...@objectstyle.org>
To: <us...@cayenne.apache.org>
Sent: Wednesday, February 14, 2007 9:57 AM
Subject: OutOfMemoryErrors


> Frank,
> 
> thanks for confirming the fix. Also please send a message with a  
> different subject whenever you start a new topic (I changed the reply  
> subject to reflect the changing topic).
> 
> Now, OutOfMemoryErrors... There are two ways to address them:
> 
> 1. increase the available heap size:
> 
> http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/10/0098.html
> 
> 2. use less memory. i.e. check how many objects your queries return.  
> If it is in the tens or hundreds of thousands you may need to think  
> of redesigning your app or use result iterator, or paginated queries,  
> whichever is more appropriate in your case:
> 
> http://cayenne.apache.org/doc/iterating-through-data-rows.html
> http://cayenne.apache.org/doc/paginated-queries.html
> 
> Andrus
> 
> 
> On Feb 14, 2007, at 9:34 AM, Frank wrote:
>> Hi Andrus,
>>
>> I regenerated the code and eclipse does not complain about source  
>> errors.
>> I am still having problems, but since I am new to Cayenne, it just  
>> may be a coding issue:
>> When I attempt to retrieve some records, I get this error:
>>
>> javax.servlet.ServletException: Servlet execution threw an exception
>> net.sf.click.extras.cayenne.DataContextFilter.doFilter 
>> (DataContextFilter.java:125)java.lang.OutOfMemoryError: Java heap  
>> spaceHere is my code:private List filterEmployees(String lname,  
>> String fname) {     DataContext context =  
>> DataContext.getThreadDataContext();     Expression qualifier1  
>> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYFNM_PROPERTY,fname 
>> +"%");     Expression qualifier2  
>> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYLNM_PROPERTY,lname 
>> +"%");     SelectQuery query = new SelectQuery 
>> (Bsypemp.class,qualifier2);     List records = context.performQuery 
>> (query);     return records;    }ThanksFrank
> 
>

How do I retrieve a record with two fields for PK

Posted by Frank <fa...@hotmail.com>.
Hello,

I have this defined:
DataContext context = DataContext.getThreadDataContext();     
Bsypemp emp = null;
emp = (Bsypemp) DataObjectUtils.objectForPK(context, Bsypemp.class, id);

my problem is that the PK consists of two fields EMHSP# & EMEMP

What is the correct syntax for getting a record?

Thanks

Frank

Re: OutOfMemoryErrors (solved)

Posted by Frank <fa...@hotmail.com>.
Hi Andrus,

I bumped the JVM up to 512m
This resolved my issue.
I also removed AS400 fields not needed in my query to help reduce memory 
requirements.

Regards,

Frank 


OutOfMemoryErrors

Posted by Andrus Adamchik <an...@objectstyle.org>.
Frank,

thanks for confirming the fix. Also please send a message with a  
different subject whenever you start a new topic (I changed the reply  
subject to reflect the changing topic).

Now, OutOfMemoryErrors... There are two ways to address them:

1. increase the available heap size:

http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/10/0098.html

2. use less memory. i.e. check how many objects your queries return.  
If it is in the tens or hundreds of thousands you may need to think  
of redesigning your app or use result iterator, or paginated queries,  
whichever is more appropriate in your case:

http://cayenne.apache.org/doc/iterating-through-data-rows.html
http://cayenne.apache.org/doc/paginated-queries.html

Andrus


On Feb 14, 2007, at 9:34 AM, Frank wrote:
> Hi Andrus,
>
> I regenerated the code and eclipse does not complain about source  
> errors.
> I am still having problems, but since I am new to Cayenne, it just  
> may be a coding issue:
> When I attempt to retrieve some records, I get this error:
>
> javax.servlet.ServletException: Servlet execution threw an exception
> net.sf.click.extras.cayenne.DataContextFilter.doFilter 
> (DataContextFilter.java:125)java.lang.OutOfMemoryError: Java heap  
> spaceHere is my code:private List filterEmployees(String lname,  
> String fname) {     DataContext context =  
> DataContext.getThreadDataContext();     Expression qualifier1  
> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYFNM_PROPERTY,fname 
> +"%");     Expression qualifier2  
> =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYLNM_PROPERTY,lname 
> +"%");     SelectQuery query = new SelectQuery 
> (Bsypemp.class,qualifier2);     List records = context.performQuery 
> (query);     return records;    }ThanksFrank


Re: How do you deal with AS400 schemas

Posted by Frank <fa...@hotmail.com>.
Hi Andrus,

I regenerated the code and eclipse does not complain about source errors.
I am still having problems, but since I am new to Cayenne, it just may be a 
coding issue:
When I attempt to retrieve some records, I get this error:

javax.servlet.ServletException: Servlet execution threw an exception
 net.sf.click.extras.cayenne.DataContextFilter.doFilter(DataContextFilter.java:125)java.lang.OutOfMemoryError: Java heap spaceHere is my code:private List filterEmployees(String lname, String fname) {     DataContext context = DataContext.getThreadDataContext();     Expression qualifier1 =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYFNM_PROPERTY,fname+"%");     Expression qualifier2 =ExpressionFactory.likeIgnoreCaseExp(Bsypemp.EMYLNM_PROPERTY,lname+"%");     SelectQuery query = new SelectQuery(Bsypemp.class,qualifier2);     List records = context.performQuery(query);     return records;    }ThanksFrank

Re: How do you deal with AS400 schemas

Posted by Frank <fa...@hotmail.com>.
Hi Andrus,
I am running into another problem when I try to query the PK's
My the look of the map generated, it looks like Cayenne is not removing the 
# for the PK's

here is a snapshot;

 public static final String E_MEMPPOUND_PROPERTY = "eMEMPpound";
    public static final String E_MWPHPOUND_PROPERTY = "eMWPHpound";
    public static final String EMOTSH_PROPERTY = "emotsh";
    public static final String EMSCH_PROPERTY = "emsch";
    public static final String EMYFNM_PROPERTY = "emyfnm";
    public static final String EMYLNM_PROPERTY = "emylnm";
    public static final String DEPARTMENTS_PROPERTY = "departments";

    public static final String EMEMPPOUND_PK_COLUMN = "EMEMP#";
    public static final String EMHSPPOUND_PK_COLUMN = "EMHSP#";

Maybe I am just doing something wrong, but wanted to let you know.

Frank
----- Original Message ----- 
From: "Andrus Adamchik" <an...@objectstyle.org>
To: <us...@cayenne.apache.org>
Sent: Tuesday, February 13, 2007 6:26 PM
Subject: Re: How do you deal with AS400 schemas


> Frank,
>
> I put a patched version of Cayenne 1.2 here:
>
> http://people.apache.org/~aadamchik/patched/cayenne-1.2-dev- 
> win-02132007.zip
>
> Could you please give it a try and report how it worked? If it does,  I'll 
> commit the fix, and it will be available officially in the  future 
> versions of Cayenne.
>
> Thanks
> Andrus
>
>
>
> On Feb 13, 2007, at 11:51 AM, Frank wrote:
>
>> Hi Andrus,
>>
>> I have submitted this as a open a bug report.
>>
>> Frank
>>
>> ----- Original Message ----- From: "Andrus Adamchik" 
>> <an...@objectstyle.org>
>> To: <us...@cayenne.apache.org>
>> Sent: Tuesday, February 13, 2007 11:40 AM
>> Subject: Re: How do you deal with AS400 schemas
>>
>>
>>> Hmm... I'd say this is a bug in Cayenne class generator. We need  to 
>>> replace non-java chars with something more appropriate. Could  you 
>>> please open a bug report:
>>> https://issues.apache.org/cayenne/
>>> Thanks
>>> Andrus
>>> On Feb 13, 2007, at 11:37 AM, Frank wrote:
>>>> Hello,
>>>> Cayenne is generating code that has # because our AS400 database 
>>>> tables use these as field names.
>>>> Severity and Description Path Resource Location Creation Time Id
>>>> Syntax error on token "Invalid Character", , expected jcdsurvey/ src/ 
>>>> stemc/cayenne/as400/auto _Bsypemp.java line 199  1171384311117 13668
>>>>
>>>> public static final String EMEMP#_PK_COLUMN = "EMEMP#";
>>>> public static final String EMHSP#_PK_COLUMN = "EMHSP#";
>>>>
>>>> Should I just use a Raw Sql?
>>>> I had to remove the # from the objEntity as Cayenne complained.
>>>>
>>>> Thanks
>>>>
>>>> Frank
>>>>
>>>
>>
>
> 


Re: How do you deal with AS400 schemas

Posted by Frank Rocco <fa...@hotmail.com>.
Hi Andrus,

Ok, I am home now and will try it out tomorrow.
Thanks for getting right on this.



Regards,

Frank Rocco
farocco@hotmail.com




>From: Andrus Adamchik <an...@objectstyle.org>
>Reply-To: user@cayenne.apache.org
>To: user@cayenne.apache.org
>Subject: Re: How do you deal with AS400 schemas
>Date: Tue, 13 Feb 2007 18:26:11 -0500
>
>Frank,
>
>I put a patched version of Cayenne 1.2 here:
>
>http://people.apache.org/~aadamchik/patched/cayenne-1.2-dev- 
>win-02132007.zip
>
>Could you please give it a try and report how it worked? If it does,  I'll 
>commit the fix, and it will be available officially in the  future versions 
>of Cayenne.
>
>Thanks
>Andrus
>
>
>
>On Feb 13, 2007, at 11:51 AM, Frank wrote:
>
>>Hi Andrus,
>>
>>I have submitted this as a open a bug report.
>>
>>Frank
>>
>>----- Original Message ----- From: "Andrus Adamchik"  
>><an...@objectstyle.org>
>>To: <us...@cayenne.apache.org>
>>Sent: Tuesday, February 13, 2007 11:40 AM
>>Subject: Re: How do you deal with AS400 schemas
>>
>>
>>>Hmm... I'd say this is a bug in Cayenne class generator. We need  to  
>>>replace non-java chars with something more appropriate. Could  you  
>>>please open a bug report:
>>>https://issues.apache.org/cayenne/
>>>Thanks
>>>Andrus
>>>On Feb 13, 2007, at 11:37 AM, Frank wrote:
>>>>Hello,
>>>>Cayenne is generating code that has # because our AS400 database   
>>>>tables use these as field names.
>>>>Severity and Description Path Resource Location Creation Time Id
>>>>Syntax error on token "Invalid Character", , expected jcdsurvey/ src/ 
>>>>stemc/cayenne/as400/auto _Bsypemp.java line 199  1171384311117 13668
>>>>
>>>>public static final String EMEMP#_PK_COLUMN = "EMEMP#";
>>>>public static final String EMHSP#_PK_COLUMN = "EMHSP#";
>>>>
>>>>Should I just use a Raw Sql?
>>>>I had to remove the # from the objEntity as Cayenne complained.
>>>>
>>>>Thanks
>>>>
>>>>Frank
>>>>
>>>
>>
>



Re: How do you deal with AS400 schemas

Posted by Andrus Adamchik <an...@objectstyle.org>.
Frank,

I put a patched version of Cayenne 1.2 here:

http://people.apache.org/~aadamchik/patched/cayenne-1.2-dev- 
win-02132007.zip

Could you please give it a try and report how it worked? If it does,  
I'll commit the fix, and it will be available officially in the  
future versions of Cayenne.

Thanks
Andrus



On Feb 13, 2007, at 11:51 AM, Frank wrote:

> Hi Andrus,
>
> I have submitted this as a open a bug report.
>
> Frank
>
> ----- Original Message ----- From: "Andrus Adamchik"  
> <an...@objectstyle.org>
> To: <us...@cayenne.apache.org>
> Sent: Tuesday, February 13, 2007 11:40 AM
> Subject: Re: How do you deal with AS400 schemas
>
>
>> Hmm... I'd say this is a bug in Cayenne class generator. We need  
>> to  replace non-java chars with something more appropriate. Could  
>> you  please open a bug report:
>> https://issues.apache.org/cayenne/
>> Thanks
>> Andrus
>> On Feb 13, 2007, at 11:37 AM, Frank wrote:
>>> Hello,
>>> Cayenne is generating code that has # because our AS400 database   
>>> tables use these as field names.
>>> Severity and Description Path Resource Location Creation Time Id
>>> Syntax error on token "Invalid Character", , expected jcdsurvey/ 
>>> src/ stemc/cayenne/as400/auto _Bsypemp.java line 199  
>>> 1171384311117 13668
>>>
>>> public static final String EMEMP#_PK_COLUMN = "EMEMP#";
>>> public static final String EMHSP#_PK_COLUMN = "EMHSP#";
>>>
>>> Should I just use a Raw Sql?
>>> I had to remove the # from the objEntity as Cayenne complained.
>>>
>>> Thanks
>>>
>>> Frank
>>>
>>
>


Re: How do you deal with AS400 schemas

Posted by Frank <fa...@hotmail.com>.
Hi Andrus,

I have submitted this as a open a bug report.

Frank

----- Original Message ----- 
From: "Andrus Adamchik" <an...@objectstyle.org>
To: <us...@cayenne.apache.org>
Sent: Tuesday, February 13, 2007 11:40 AM
Subject: Re: How do you deal with AS400 schemas


> Hmm... I'd say this is a bug in Cayenne class generator. We need to  
> replace non-java chars with something more appropriate. Could you  
> please open a bug report:
> 
> https://issues.apache.org/cayenne/
> 
> Thanks
> Andrus
> 
> 
> On Feb 13, 2007, at 11:37 AM, Frank wrote:
> 
>> Hello,
>> Cayenne is generating code that has # because our AS400 database  
>> tables use these as field names.
>> Severity and Description Path Resource Location Creation Time Id
>> Syntax error on token "Invalid Character", , expected jcdsurvey/src/ 
>> stemc/cayenne/as400/auto _Bsypemp.java line 199 1171384311117 13668
>>
>> public static final String EMEMP#_PK_COLUMN = "EMEMP#";
>> public static final String EMHSP#_PK_COLUMN = "EMHSP#";
>>
>> Should I just use a Raw Sql?
>> I had to remove the # from the objEntity as Cayenne complained.
>>
>> Thanks
>>
>> Frank
>>
> 
>

Re: How do you deal with AS400 schemas

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hmm... I'd say this is a bug in Cayenne class generator. We need to  
replace non-java chars with something more appropriate. Could you  
please open a bug report:

https://issues.apache.org/cayenne/

Thanks
Andrus


On Feb 13, 2007, at 11:37 AM, Frank wrote:

> Hello,
> Cayenne is generating code that has # because our AS400 database  
> tables use these as field names.
> Severity and Description Path Resource Location Creation Time Id
> Syntax error on token "Invalid Character", , expected jcdsurvey/src/ 
> stemc/cayenne/as400/auto _Bsypemp.java line 199 1171384311117 13668
>
> public static final String EMEMP#_PK_COLUMN = "EMEMP#";
> public static final String EMHSP#_PK_COLUMN = "EMHSP#";
>
> Should I just use a Raw Sql?
> I had to remove the # from the objEntity as Cayenne complained.
>
> Thanks
>
> Frank
>