RE: Inheritance using two tables

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Tue Feb 01 2005 - 09:54:05 EST

  • Next message: Gentry, Michael \(Contractor\): "RE: Inheritance using two tables"

    Andre,

    Since Cayenne doesn't currently support this, I just model the two
    tables separately and create a relationship between the subclass and
    superclass. Then I add cover methods in the subclass to return
    toSuperClass.whatever(), which simulates things "correctly". Of course,
    this is for reading, only. You can add cover methods for setting
    attributes, too. You also have to more manually manage creating them,
    too, since you need to create both at the same time (although this can
    be automated a bit in the subclass using the setPersistenceState()
    method and if the state is NEW, create/insert the superclass, too).

    The cover methods/etc aren't really required, but they make the code
    using the business objects a bit nicer.

    /dev/mrg

    -----Original Message-----
    From: Andre Bremer [mailto:a.breme..olff-olins.com]
    Sent: Tuesday, February 01, 2005 8:35 AM
    To: cayenne-use..bjectstyle.org
    Subject: Inheritance using two tables

    Hi

    How does one map an associated database schema?
    Where we have one base table representing the super class and any number

    of other tables representing the concrete sub classes.

    I understand the documentation of single table inheritance but can't
    find any help on the above.

    Also I can't search the mail archive, am I missing something?

    cheers

    as

    * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    This e-mail message is intended solely for the person to
    whom it is addressed and may contain confidential or
    privileged information. If you have received it in error,
    please notify the postmaste..olff-olins.com
    immediately and destroy this e-mail and any attachments.
    In addition, you must not disclose, copy, distribute or take
    any action in reliance on this e-mail or any attachments.

    Any views or opinions presented in this e-mail are solely
    those of the author and do not necessarily represent
    those of Wolff Olins. E-mail may be susceptible to
    data corruption, interception, unauthorised amendment,
    viruses and unforeseen delays, and we do not accept
    liability for any such data corruption, interception,
    unauthorised amendment, viruses and delays or the
    consequences thereof.
    Accordingly, this e-mail and any attachments
    are opened at your own risk.
    http://www.wolff-olins.com

    * * * * * * * * * * * * * * * * * * * * * * * * * * * *



    This archive was generated by hypermail 2.0.0 : Tue Feb 01 2005 - 09:54:10 EST