Re: inheritance

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Mar 23 2009 - 04:18:46 EDT

  • Next message: Andrey Razumovsky: "Any way to check if object has really changed?"

    In 3.0 you can start with an abstract ObjEntity instead of a
    superclass outside Cayenne. You will still have to create those
    columns in the DbEntity definitions. Also this feature is rather new,
    so there may be some snags in runtime.

    So I guess the safest path is what I described in my original message.
    Also if you are on 3.0M5, you can use copy/paste in the Modeler to
    propagate common DbAttributes. Not ideal of course, but should
    eliminate some typing and clicking.

    Andrus

    On Mar 23, 2009, at 9:29 AM, csergiu77 wrote:
    >
    > Hi
    > thx for answer ,glad that is possible but is till have one question.
    >
    > if i start desingning the database i should add this commom fileds
    > manually
    > to all tables ?
    >
    > or is possible to start with objects and then generate tables ?
    >
    > cause if i start with objects and for each object i create i just
    > specify
    > that it extedns a class that has those common fields then is super
    > ok .
    >
    >
    >
    >
    >
    > Andrus Adamchik wrote:
    >>
    >> Hi there,
    >>
    >> you can use a common superclass that extends CayenneDataObject. Enter
    >> it for the DataMap under "Custom Superclass" and then click
    >> "Update...".
    >>
    >> Optionally you may declare getters and setters as abstract in this
    >> superclass. Whether you do that or not, Cayenne will generate correct
    >> access code in subclasses.
    >>
    >> Andrus
    >>
    >>
    >> On Mar 21, 2009, at 9:22 PM, csergiu77 wrote:
    >>
    >>>
    >>> i would like to do the folowing :
    >>>
    >>> each table that i will have into my database must have :
    >>>
    >>>
    >>> id
    >>> create_date
    >>> create_user_id
    >>> write_date
    >>> write_user_id
    >>>
    >>>
    >>> Normally i though to subclass each of my data model classes to a
    >>> class
    >>> that has these fields.
    >>>
    >>> How this can be done using cayenne ?
    >>>
    >>> Thx
    >>> --
    >>> View this message in context:
    >>> http://www.nabble.com/inheritance-tp22639408p22639408.html
    >>> Sent from the Cayenne - User mailing list archive at Nabble.com.
    >>>
    >>>
    >>
    >>
    >>
    >
    > --
    > View this message in context: http://www.nabble.com/inheritance-tp22639408p22655366.html
    > Sent from the Cayenne - User mailing list archive at Nabble.com.
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Mar 23 2009 - 04:19:20 EDT