Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 58141 invoked from network); 29 May 2006 14:38:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 May 2006 14:38:18 -0000 Received: (qmail 29260 invoked by uid 500); 29 May 2006 14:38:17 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 29240 invoked by uid 500); 29 May 2006 14:38:17 -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 29230 invoked by uid 99); 29 May 2006 14:38:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 May 2006 07:38:16 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of blacknext@gmail.com designates 64.233.166.181 as permitted sender) Received: from [64.233.166.181] (HELO py-out-1112.google.com) (64.233.166.181) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 May 2006 07:38:16 -0700 Received: by py-out-1112.google.com with SMTP id d80so220057pyd for ; Mon, 29 May 2006 07:37:55 -0700 (PDT) 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=nzzapYgLWd0422paZOT/kJDOkRcr1W9imNgJhrayWUGoKThfGYFFTtJyQJ/7qE8g9C0Sph8ynlCn5G1ax06WUGM5wuOB9YKTLqF3SI187qafSFh2pStE4Tz1g12mwg18aARCudv9OukmGD/OUiZcHsWJi9+WjQZsh3xkj36f4TQ= Received: by 10.35.9.2 with SMTP id m2mr1964649pyi; Mon, 29 May 2006 07:37:55 -0700 (PDT) Received: by 10.35.126.6 with HTTP; Mon, 29 May 2006 07:37:55 -0700 (PDT) Message-ID: Date: Mon, 29 May 2006 10:37:55 -0400 From: "Michael Gentry" To: cayenne-user@incubator.apache.org Subject: Re: Type for class designator column when using STI? In-Reply-To: <4477AB7D.8010900@pfrog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4477AB7D.8010900@pfrog.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N You should be able to use integers or strings (or others, but those are the most practical). When mapping to a legacy schema we have, I mapped PSEnumeratedItem as a subclass of PSItem. Set the Java class (I think the superclass is automatically set when you use the pulldown to specify the parent) to your desired class, and in the qualifier enter you criteria. For example, mine is: moniker =3D "ES" But you could easily have an integer listed in there. Cayenne should automatically create the correct class instance for you when it reads from the DB. Also, make sure you initialize the correct values when you create new objects (Cayenne doesn't do this for you automatically). For example: public class PSEnumeratedItem extends _PSEnumeratedItem { public void setPersistenceState(int state) { super.setPersistenceState(state); // if object was just created, initialize values if (state =3D=3D PersistenceState.NEW) { setMoniker("ES"); } } } /dev/mrg PS. My qualifier (they have to differ) for PSItem is: moniker =3D "QQ" PPS. I don't remember if it is required that the parent has a qualifier. On 5/26/06, Jeff de Vries wrote: > Does it matter what data type the "class designator column" is when > using STI? Are there any expectations on the values in the class > designator column? For example, can you use an integer column, with 1 > meaning Employee, 2 meaning Manager, 3 meaning Customer, etc? Does > Cayenne know what class to instantiate by looking at the qualifier > expression? > > Thanks, > Jeff de Vries > >