Re: Re: Persistence and inheritance : a noob question

From: Michael Gentry (blacknex..mail.com)
Date: Tue Nov 28 2006 - 18:29:34 EST

  • Next message: Tore Halset: "Re: Problems with prepared statements"

    This page might help:

    http://cwiki.apache.org/confluence/display/CAYDOC12/Modeling+Inheritance

    Also, look at the ObjEntity section in Cayenne Modeler. Specifically
    the Inheritance and Table/View pulldowns. Also, the Qualifier field,
    which is how you specify the discriminator so Cayenne can determine
    which Java class it represents. (The above web page shows an example
    of such a qualifier.)

    /dev/mrg

    On 11/28/06, Landry Soules <cayennem..mail.com> wrote:
    > Thanks for your answer, Michael.
    > Actually i thought of having one table for Vip, one for Customer, and
    > none for Person.
    > Because Vip and Customer share some properties (first name, last name etc).
    > Having 2 tables seems cleaner to me, but if your solution is well
    > supported by Cayenne, why not ?
    > Would you please have a small code example to help me understand how to
    > implement it ?
    >
    > Thanks
    >
    > Landry Soules
    >
    > Michael Gentry a écrit :
    > > Are you wanting multiple tables or a single table? Cayenne will
    > > currently do a single table mapped to multiple Java classes pretty
    > > well. You have to have a discriminator column (an int or a char, etc)
    > > which Cayenne can use to detect which Java class to create. Such as 1
    > > = Customer, 2 = VIP, etc.
    > >
    > > /dev/mrg
    > >
    > >
    > > On 11/28/06, Landry Soules <cayennem..mail.com> wrote:
    > >> Hello,
    > >>
    > >> I'm a new user of Cayenne, and am facing a design problem. Here it is :
    > >> I would like to implement the following :
    > >> - a Person abstract class (with first name, last name and so on
    > >> properties), extended by Customer and Vip classes.
    > >> In my mind, Person wouldn't be persistent, whereas Customer and Vip
    > >> would, meaning having only customer and vip tables.
    > >> Does this fit into the FAQ's CompositeVerticalInheritence, or does exist
    > >> a simpler alternative, since i must admit i didn't understand how to use
    > >> it ?
    > >>
    > >> Thanks
    > >>
    > >> Landry Soules
    > >>
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Nov 28 2006 - 18:30:27 EST