Re: Understanding Pks:

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jul 23 2003 - 00:20:28 EDT

  • Next message: Laszlo Spoor: "Re: Understanding Pks:"

    On Tuesday, July 22, 2003, at 11:27 PM, Adrian wrote:

    > This is a basic question but I don know how to handle it:
    >  
    > I.e. ...if a I have a table STATES, that table has two fields:
    > ID_STATE and NAME...
    > ID_STATE is the PK field and it is autogenerated using cayenne pk
    > generation support.
    >  
    > The modeler generates a class with only the name attribute (pk fields
    > doesn't get reflected on class generation)....My question is: if i.e.
    > I want to populate a combo with all the values of this table and I
    > want to label the option with the field NAMEbut set the option's real
    > value with ID_STATE field value...how can I get this value from the
    > class if I the modeler doesn't create a proper attribute and  its
    > getter/setter methods...surely I'am missing something...any help will
    > be appreciated...Thx in advance!

    Hi Adrian,

    Here is some background on that issue:

    http://objectstyle.org/cayenne/lists/cayenne-user/2003/05/0071.html
    http://objectstyle.org/cayenne/lists/cayenne-user/2003/05/0072.html

    Basically the idea is to keep your id opaque unless absolutely
    necessary (which is like all the time in the Struts/JSP world :-/).
    Links above explain how to get a value for id.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Jul 23 2003 - 00:18:01 EDT