db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Inheritence question
Date Mon, 20 Jun 2005 09:14:41 GMT




Is that already supported or is this a suggestion ? If it is a suggestion,
can you please open up a scarab issue on that ?

         Thanks,

               Thomas

"Mickey Mokotov" <mickey@fetchbook.info> schrieb am 20.06.2005 11:44:34:

> Another way is to add a children element "class" to column and only the
> defined classes will have methods for this specific column.
> For example (using my previous example):
>
> <table name="A">
>     <column name="a" type="INTEGER" primaryKey="true"/>
>     <column name="b" type="INTEGER" primaryKey="true">
>        <class class="B"/>
>     </column>
>     <column name="c" type="INTEGER" primaryKey="true">
>        <class class="C"/>
>     </column>
>     <column name="FOO" inheritance="single" type="CHAR" size="1">
>        <inheritance key="B" class="B"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>        <inheritance key="C" class="C"
> extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
>     </column>
>  </table>
>
>
> -----Original Message-----
> From: Thomas Fischer [mailto:fischer@seitenbau.net]
> Sent: Monday, June 20, 2005 9:59 AM
> To: Apache Torque Developers List
> Subject: RE: Inheritence question
>
>
>
>
>
>
> Hi,
>
> I am afraid there is nothing to achieve this out of the box. There is no
way
> Torque can know  which column belongs to which class from the schema.xml
> (and I do not know a way how this could be specified). Of course you can
> subclass the setters of the unwanted column and throw an exception,
making
> sure that they can never be called. But this is not the optimal solution,
it
> would be better if they would not be visible. One way to achieve this
might
> be to change the templates such that for inheritance base classes, the
> getters and setters are made protected and you make just the wanted
columns
> public in the subclass.
>
>           Thomas
>
> "Mickey Mokotov" <mickey@fetchbook.info> schrieb am 19.06.2005 19:11:42:
>
> > Hi fellows,
> > I'm a bit embraced to ask but I can't find it on the docs, nor any
> example
> > on the web.
> >
> > I understand that torque implements inheritance using one table and I
> have a
> > question with regards to the properties-
> >
> > Let's say class B and C inherits from A.
> > A has the attribute a.
> > B has the attribute b (and the one inherited from A).
> > C has the attribute c (and the one inherited from A).
> >
> > Is there any way to avoid the situation in which class B has all three
> > methods getA() ... getC() ?
> >
> > E.g. have a schema other than:
> >
> > <table name="A">
> >    <column name="a" type="INTEGER" primaryKey="true"/>
> >    <column name="b" type="INTEGER" primaryKey="true"/>
> >    <column name="c" type="INTEGER" primaryKey="true"/>
> >    <column name="FOO" inheritance="single" type="CHAR" size="1">
> >       <inheritance key="B" class="B"
> > extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
> >       <inheritance key="C" class="C"
> > extends="com.isbn.logic.beans.torqueOM.fetchbookCentral.A"/>
> >    </column>
> > </table>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-dev-help@db.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message