Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 58106 invoked from network); 28 Nov 2006 22:41:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Nov 2006 22:41:52 -0000 Received: (qmail 18402 invoked by uid 500); 28 Nov 2006 22:42:00 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 18385 invoked by uid 500); 28 Nov 2006 22:42:00 -0000 Mailing-List: contact cayenne-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cayenne-user@incubator.apache.org Delivered-To: mailing list cayenne-user@incubator.apache.org Received: (qmail 18376 invoked by uid 99); 28 Nov 2006 22:42:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Nov 2006 14:42:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of malcolm.edgar@gmail.com designates 64.233.162.234 as permitted sender) Received: from [64.233.162.234] (HELO nz-out-0102.google.com) (64.233.162.234) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Nov 2006 14:41:48 -0800 Received: by nz-out-0102.google.com with SMTP id j2so908436nzf for ; Tue, 28 Nov 2006 14:41:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=n5gdWK08DbrPVuXpJlkytIqQvXEzuKntTgqtdliiR75laN0ge20IZZ+JWZsEsz7LSI3VUQ24BqYWqBo5aONbtgdyvCWdxJjoQwEy8eYDzycEWUHgO8t9FYxrmaD9+Aglp/slH7JYixEe35d1DH9E2SR6bpzSmmaISQfUt8MnjY8= Received: by 10.65.236.18 with SMTP id n18mr596310qbr.1164753687739; Tue, 28 Nov 2006 14:41:27 -0800 (PST) Received: by 10.64.250.4 with HTTP; Tue, 28 Nov 2006 14:41:27 -0800 (PST) Message-ID: <525d8e10611281441q3e837240xfa82d47fdbac818b@mail.gmail.com> Date: Wed, 29 Nov 2006 09:41:27 +1100 From: "Malcolm Edgar" To: cayenne-user@incubator.apache.org Subject: Re: Persistence and inheritance : a noob question In-Reply-To: <456CB918.7040305@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <456CA158.1050401@gmail.com> <456CB918.7040305@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org My 2 bits worth.. I find the single table model works better than modeling class inheritance through multiple tables. The reason being you have less referential integrity constraints to worry about when using a single table regards Malcolm On 11/29/06, Landry Soules 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 =E9crit : > > 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 > > =3D Customer, 2 =3D VIP, etc. > > > > /dev/mrg > > > > > > On 11/28/06, Landry Soules 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 exi= st > >> a simpler alternative, since i must admit i didn't understand how to u= se > >> it ? > >> > >> Thanks > >> > >> Landry Soules > >> > > > >