Re: Cayenne modeler - need to generate setters and getters for primary key

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 08 2005 - 16:51:26 EST

  • Next message: Robert Zeigler: "Re: Serialization questions"

    Hi Arun,

    The problem is not that the id Java attribute is not *generated*, rather
    it is not *mapped*. Once you map it, it will be picked up by code
    generation template. To do that, manually add an ObjAtribute to the
    ObjEntity in question (select an entity in question -
    http://objectstyle.org/cayenne/images/modeler/icon-objentity.gif, click on
    attributes tab, then click Add Attribute -
    http://objectstyle.org/cayenne/images/modeler/icon-attribute.gif) and
    select your PK column from the dropdown.

    Andrus

    > I have an already existing database table that has a meaningful primary
    > key (say, the government issued Social Security Number). I need to
    > access and display this primary key just like any attribute of the
    > object generated for the table. The Cayenne modeler, by default, does
    > not seem to generate a setter or a getter for the primary key in the
    > generated classes. How do I make it generate a setter and a getter for
    > the primary key ?
    >
    > Please note that section 4.7.1 of the Cayenne 1.1 User Guide
    > (http://www.objectstyle.org/cayenne/userguide/design/autopk.html)
    > briefly mentions this situation but does not say how to make the modeler
    > handle this situation.
    >
    > Any help is appreciated,
    >
    > Arun Shankar
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 08 2005 - 16:51:27 EST