FAQ
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.

Search Discussions

  • Andrus Adamchik at Mar 23, 2009 at 7:16 am
    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.
  • Csergiu77 at Mar 23, 2009 at 7:30 am
    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.
  • Andrus Adamchik at Mar 23, 2009 at 8:19 am
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMar 21, '09 at 7:23p
activeMar 23, '09 at 8:19a
posts4
users2
websitecayenne.apache.org

2 users in discussion

Andrus Adamchik: 2 posts Csergiu77: 2 posts

People

Translate

site design / logo © 2022 Grokbase