How do I get a record for non integer pk?

2007-05-16 Thread Frank
Hello, The code below is not working, as it expects the PK to be integer. There is only one String field in the table defined as a pk. Thanks Frank private void getRecord(String name) { DataContext context = DataContext.getThreadDataContext(); System s = new System(); s =

Re: How do I get a record for non integer pk?

2007-05-16 Thread Bryan Lewis
We use that objectForPK() method routinely with a String key and haven't had any problems. What do you mean by not working? Is it throwing a CayenneRuntimeException? Frank wrote: Hello, The code below is not working, as it expects the PK to be integer. There is only one String field in the

Re: How do I get a record for non integer pk?

2007-05-16 Thread Andrus Adamchik
Exactly. There is an 'objectForPk(.., int)' and another one 'objectForPk(.., Object)': http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/ DataObjectUtils.html Andrus On May 16, 2007, at 8:01 PM, Bryan Lewis wrote: We use that objectForPK() method routinely with a String key

Re: How do I get a record for non integer pk?

2007-05-16 Thread Frank
(EditSystemPage.java:71) Thanks Frank - Original Message - From: Bryan Lewis [EMAIL PROTECTED] To: user@cayenne.apache.org Sent: Wednesday, May 16, 2007 1:01 PM Subject: Re: How do I get a record for non integer pk? We use that objectForPK() method routinely with a String key and haven't had any

Re: How do I get a record for non integer pk?

2007-05-16 Thread Andrus Adamchik
) at stemc.page.EditSystemPage.getRecord(EditSystemPage.java:41) at stemc.page.EditSystemPage.onGet(EditSystemPage.java:71) Thanks Frank - Original Message - From: Bryan Lewis [EMAIL PROTECTED] To: user@cayenne.apache.org Sent: Wednesday, May 16, 2007 1:01 PM Subject: Re: How do I get a record for non integer pk? We use

Re: How do I get a record for non integer pk?

2007-05-16 Thread Frank
: Re: How do I get a record for non integer pk? These two lines are not the same: at org.objectstyle.cayenne.DataObjectUtils.intPKForObject (DataObjectUtils.java:93) s = (System) DataObjectUtils.objectForPK(context, System.class, name); So now you are talking about a different problem

Re: How do I get a record for non integer pk?

2007-05-16 Thread Andrus Adamchik
, May 16, 2007 1:17 PM Subject: Re: How do I get a record for non integer pk? These two lines are not the same: at org.objectstyle.cayenne.DataObjectUtils.intPKForObject (DataObjectUtils.java:93) s = (System) DataObjectUtils.objectForPK(context, System.class, name); So now you are talking