RE: Inheritance using two tables

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

  • Next message: Andrus Adamchik: "RE: Inheritance using two tables"

    Andrus,

    Would the modeler/etc allow for a table "A" in this case, too? You'd
    want entity B to be composed of tables A&B, entity C composed of tables
    A&C, etc.

    Thanks,

    /dev/mrg

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Tuesday, February 01, 2005 9:49 AM
    To: cayenne-use..bjectstyle.org
    Subject: Re: Inheritance using two tables

    No comments on the timing, but why wouldn't a common abstract superclass
    address your requirements? From what I can tell it provides a *complete*
    functional replacement of multi table inheritance (note that in the
    modeler you can select a superclass of any entity... so two entities can
    have the same custom superclass). E.g.

    public abstract class A extends CayenneDataObject {
       public abstract String getX();
       public abstract void setX(Stirng x);

       public void doSomething() {
         ...
       }
    }

    public class B extends A { // mapped to table B

    }

    public class C extends A { // mapped to table C

    }

    Anything I might be missing here?

    Andrus

    > Andrus Adamchik wrote:
    >
    >>Hi Andre,
    >>
    >>Multiple table inheritance is currently not supported. It should be
    >> fairly easy to add, but this has to be done... I guess you'll have to
    >> map your tables as independent entities and use a common Java
    interface
    >> or better - a common abstract superclass to achieve a similar effect.
    >>
    >>Andrus
    >>
    >>
    > Andrus,
    >
    > Thank you for quick reply.
    >
    > I am stuck with our existing design, guess I'll have to wait for the
    > next cayenne version :)
    >
    > Anybody any idea when/if this feature will be added?
    >
    > cheers
    >
    > Andre
    >
    >>>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 archive was generated by hypermail 2.0.0 : Tue Feb 01 2005 - 09:57:59 EST