db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Hopf <h...@synyx.de>
Subject Inheritance and additional attributes
Date Wed, 24 May 2006 08:38:41 GMT
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:

  <table name="element" abstract="false" description="the abstract
document element">
    <column
        name="id"
        required="true"
        primaryKey="true"
        type="INTEGER"
        description="Id"/>
    <column
        name="document_id"
        required="true"
        type="INTEGER"
        description="reference to the corresponding document"/>

[snip more attributes]

    <column
        name="class_type"
        inheritance="single"
        type="VARCHAR"
        size="10">
            <inheritance key="text" class="TextElement"/>
    </column>
    <foreign-key foreignTable="document" onDelete="cascade">
      <reference local="document_id" foreign="id"/>
    </foreign-key>
  </table>

And the concrete subclass like this:

<table name="text_element" abstract="false" description="element to
represent text content">
    <column
        name="content"
        required="true"
        type="VARCHAR"
        description="the text content"
    />
</table>

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


Mime
View raw message