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

From: Bryan Lewis (brya..aine.rr.com)
Date: Wed May 16 2007 - 13:01:12 EDT

  • Next message: Andrus Adamchik: "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);
    > }
    >



    This archive was generated by hypermail 2.0.0 : Wed May 16 2007 - 13:01:55 EDT