It is best suited for objects that have mostly the same attributes, but
different functionality. Torque has the ability to handle the only
inheritance model it does because I needed that type of model for a
couple projects, so I added it. Before that it created a flat object
model only. As soon as I need a model similar to what you described, I
will work on adding that to torque unless initial experiments prove that
it is too difficult and some better oss solution (such as jason's second
generation torque) already exists. Of course, if you need it now, you
could solve the problem earlier than I will and more people can benefit.
john mcnally
Jonathan Porterfield wrote:
>
> Well I guess that's a resounding "Yep, you don't get it..." :)
>
> Can you describe an instance when this would be necessary? I have read the
> document, but still don't think I could put this to use productively.
>
> Thanks again...
>
> >From: John McNally <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: Inheritance in Torque/Peers
> >Date: Wed, 19 Sep 2001 15:09:49 -0700
> >
> >Torque supports only the one table per class hierarchy style of o-r
> >mapping. The <inheritance> tag is an element of <column> not <table>.
> >It marks the column as distinguishing the different classes that are
> >stored within the table. Leaving the extends attribute out will have
> >the class extend the highest level class, the extends attribute can lead
> >to a deeper hierarchy.
> >
> >Jonathan Porterfield wrote:
> > >
> > > I'm not sure I totally get this, so can someone please check my
> > > understanding of the usage from my example below?
> > >
> > > Would this be the correct way to define inheritance between a base user
> > > table and an authors table in the database definition...
> > >
> > > Where the two tables have the following definition.
> > > ------------ ------------
> > > | USERS |---o-| AUTHORS |
> > > ------------- ------------
> > >
> > > <app-data>
> > >
> > > <database name=MyData>
> > >
> > > <table name="USERS" idMethod="idbroker">
> > > <column name="USERID" inheritance="single" type="INTEGER" size="4"
> > > primaryKey="true"/>
> > > <inheritance key="AUTHORS" class="AUTHORS"
> > > extends="com.mycompany.project.om.USERS"/>
> > > <column name="USER_NAME" type="VARCHAR" size="255" />
> > > </table>
> > >
> > > <table name="AUTHORS" idMethod="idbroker" >
> > > <column name="AUTHORID" type="INTEGER" size="4" primaryKey="true"
> > > required="true"/>
> > > <column name="USERID" type="INTEGER" size="4" />
> > > <column name="AUTHOR_BIO" type="VARCHAR" size="255"/>
> > > <foreign-key foreighTable="USERS">
> > > <reference foreign= local=>
> > > </foreign-key>
> > > </table>
> > >
> > > </database>
> > >
> > > </app-data>
> > > ------------------
> > > Here, AUTHORS extends USERS so...
> > > 1) Criteria crit = new Criteria();
> > > AuthorsPeer.doSelect(crit);
> > >
> > > should fetch
> > > - USERID, USER_NAME, AUTHORID, AUTHOR_BIO
> > >
> > > (T/F)?
> > >
> > > 2) And by the same token, and although it would be unconventional, it
> >would
> > > be possible to use
> > > Criteria crit = new Criteria();
> > > crit.add (AuthorsPeer.UserName,"Ralph Malph");
> > > Object o = CategoryPeer.doInsert (crit);
> > >
> > > to add a "Ralph Malph" user to the USERS table
> > > (T/F)?
> > >
> > > 3) Will this also create a row in the AUTHORS table?
> > >
> > > 4) Question - If inheritance is defined, is foreign-key definition
> >redundant
> > > to the point of uselessness?
> > >
> > > 5) I see in the DTD that the attribute "extends" of the element
> > > "inheritance" is optional (#IMPLIED).
> > > What would be the effect of removing the extends attribute from the
> > > inheritance attribute in the example above?
> > >
> > > Thanks in advance for any response
> > > -Cheers
> > >
> > > _________________________________________________________________
> > > Get your FREE download of MSN Explorer at
> >http://explorer.msn.com/intl.asp
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]