Hi Frank,

this is more of a Click issue than a Cayenne issue. So the Click forum
is would be a better place to raise it.

In our applications we use java.lang.Long for the DataObject primary
key values, mapping to a MySQL BIGINT.  There is an outstanding task
to relax the primary key type to support strings, this might get
through into the Click 1.3 release.

regards Malcolm Edgar

On 5/17/07, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
I think you are right. Click CayenneForm IIRC does not support non-
int PK's. Your stack confirms that:

>>> at org.objectstyle.cayenne.DataObjectUtils.intPKForObject
>>> (DataObjectUtils.java:93)
>>> at net.sf.click.extras.cayenne.CayenneForm.setDataObject
>>> (CayenneForm.java:335)


Andrus

On May 16, 2007, at 8:23 PM, Frank wrote:

> I think it has something to do with Click CayenneForm
> I changed CayenneForm to Form and it works.
>
> Seems CayenneForm is tring to fetch my int id
>
> Frank
> ----- Original Message ----- From: "Andrus Adamchik"
> <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, 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 about a different problem. To fix your
>> latest  problem use "pkForObject" instead of "intPKForObject"....
>> Andrus
>> On May 16, 2007, at 8:11 PM, Frank wrote:
>>> Does it have someting to do with the System name? reserved word?
>>>
>>> Class org.objectstyle.cayenne.CayenneRuntimeException
>>> Message [v.1.2.3 May 6 2007] PK is not a number:
>>> <ObjectId:System,  System=AIX>
>>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2.3 May 6
>>> 2007] PK is not a number: <ObjectId:System, System=AIX>
>>> at org.objectstyle.cayenne.DataObjectUtils.intPKForObject
>>> (DataObjectUtils.java:93)
>>> at net.sf.click.extras.cayenne.CayenneForm.setDataObject
>>> (CayenneForm.java:335)
>>> 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: <[email protected]>
>>> 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 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 table defined as a pk.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Frank
>>>>>
>>>>> private void getRecord(String name) {
>>>>>      DataContext context = DataContext.getThreadDataContext();
>>>>>      System s = new System();
>>>>>      s = (System) DataObjectUtils.objectForPK(context,
>>>>> System.class, name);
>>>>>   form.setDataObject(s);
>>>>>     }
>>>>>
>>>>
>>>
>>>
>>
>


Reply via email to