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

From: Jürgen Saar (jsaa..eb.de)
Date: Wed Mar 09 2005 - 04:36:45 EST

  • Next message: Andrus Adamchik: "Re: Cayenne modeler - need to generate setters and getters for primary key"

    As I often mentioned, Class generation is done by Velocity,
    so you could write your own template, which creates
    getter and setter for the PK-attributes

    cayenne-use..bjectstyle.org schrieb am 08.03.05 22:51:49:
    >
    > 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
    > >
    >
    >

    __________________________________________________________
    Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
    weltweit telefonieren! http://freephone.web.de/?mc=021201



    This archive was generated by hypermail 2.0.0 : Wed Mar 09 2005 - 04:36:53 EST