From torque-user-return-7048-apmail-db-torque-user-archive=db.apache.org@db.apache.org Fri May 26 09:49:17 2006 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 34179 invoked from network); 26 May 2006 09:49:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 May 2006 09:49:17 -0000 Received: (qmail 46339 invoked by uid 500); 26 May 2006 09:49:16 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 46316 invoked by uid 500); 26 May 2006 09:49:15 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 46304 invoked by uid 99); 26 May 2006 09:49:15 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2006 02:49:15 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [217.24.207.26] (HELO mail.seitenbau.net) (217.24.207.26) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2006 02:49:14 -0700 Received: from [192.168.15.18] (helo=www.seitenbau.net) by router.seitenbau.net with esmtp (Exim 4.43) id 1FjYw9-0000wv-8s for torque-user@db.apache.org; Fri, 26 May 2006 11:48:53 +0200 In-Reply-To: <44741B91.3050700@synyx.de> Subject: RE: Inheritance and additional attributes To: "Apache Torque Users List" X-Mailer: Lotus Notes Release 6.5 September 26, 2003 Message-ID: From: Thomas Fischer Date: Fri, 26 May 2006 11:48:51 +0200 X-MIMETrack: Serialize by Router on www/seitenbau(Release 7.0.1|January 17, 2006) at 26.05.2006 11:48:52 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, It is not possible to define additional attributes in the subclasses, nor is it possible to use another table for this. You must declare all members in the one table where all the class hierarchy are saved to. What you can do is to declare the "additional" members als protected, and override the getters and setters with public methods in the subclass where you want to access them. Thomas Florian Hopf schrieb am 24.05.2006 10:38:41: > Hi *, > I'm trying to get inheritance working and can't find a solution in the > archives and the inheritance guide. > What I want to achieve is something like this: > I have an abstract class Element which defines a lot of attributes. This > class is extended by a few other concrete classes that define additional > attributes. So I define the abstract class like this: > > > name="id" > required="true" > primaryKey="true" > type="INTEGER" > description="Id"/> > name="document_id" > required="true" > type="INTEGER" > description="reference to the corresponding document"/> > > [snip more attributes] > > name="class_type" > inheritance="single" > type="VARCHAR" > size="10"> > > > > > >
> > And the concrete subclass like this: > > > name="content" > required="true" > type="VARCHAR" > description="the text content" > /> >
> > What happens is, as far as I can see, the generator generates classes > for TextElement/TextElementPeer and afterwards overwrites TextElement > with one that extends Element without the additional attribute. Is it > possible to make inheritance with additional attributes work? Do I have > to declare the attributes in Element and tag them as belonging to > TextElement somehow? > > Any hint is appreciated, > kind regards > Florian > > -- > /** > * Florian Hopf > * Synyx GmbH & Co. KG > * phone +49(0)721 9118303 > * eMail hopf@synyx.de > * www http://www.synyx.de > * irc irc.synyx.de > */ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org