Re: Inheriting CayenneDataObjects from a custom class

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue Feb 17 2004 - 09:37:16 EST

  • Next message: Gentry, Michael: "Aqua look-and-feel?"

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > On Feb 16, 2004, at 10:11 PM, Steve Steinitz wrote:
    > > My search of the archives didn't yield instructions on inserting a
    > > custom superclass for our CayenneDataObjects. We would like all
    > > (or most) of our CayenneDataObjects to have some common methods
    > > (namely 'all' for retrieving all objects from the database,
    > > 'objectForID' which takes a primary key, and perhaps other
    > > methods). Can someone provide a step by step instruction for
    > > making our _DataObject classes descend from our custom superclass?

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    > In the Modeler ObjEntity panel there is a field named "superclass". It
    > serves exactly this purpose.

    If for some reason you don't want to specify this for every ObjEntity and
    it's the same custom superclass for all DataObjects, you can also edit your
    superclass.vm or singleclass.vm code generation template and hardcode the
    value. You can find the original templates in the dotemplates folder in the
    cayenne jar (not sure where this is documented).

    I'll open a minor RFE for the modeler to globally set or change the custom
    superclass. For five ObjEntities, it's trivial. For 20, it's burdensome.
     For 100, it's ridiculous.

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Feb 17 2004 - 09:37:20 EST