Whats wrong with this XML? When set the Object model to complex I get no
methods in either the item or category peer classes that refer to the
other - like a getItemsJoinXxx(Criteria).

<database>
  <table name="ITEM">
    <column name="ITEM_ID" required="true" autoIncrement="true"
primaryKey="true" type="INTEGER"/>
    <column name="TITLE" size="255" type="VARCHAR"/>
    <column name="TEXT" size="255" type="VARCHAR"/>
    <column name="AUTHOR" size="255" type="VARCHAR"/>
    <column name="DEPT" size="255" type="VARCHAR"/>
    <column name="URL" size="255" type="VARCHAR"/>
    <column name="CATEGORY_ID" required="true" type="INTEGER"/>

   <foreign-key foreignTable="CATEGORY">
      <reference local="CATEGORY_ID" foreign="CATEGORY_ID"/>
    </foreign-key>


  </table>


  <table name="CATEGORY">
    <column name="CATEGORY_ID" required="true" autoIncrement="true"
primaryKey="true" type="INTEGER"/>
    <column name="BODY" size="255" type="VARCHAR"/>

    <foreign-key foreignTable="ITEM">
      <reference local="CATEGORY_ID" foreign="CATEGORY_ID"/>
    </foreign-key>

  </table>
</database>

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of John McNally
Sent: Thursday, February 15, 2001 1:45 PM
To: Turbine
Subject: Re: One more Peer/Join question


Table FOO has a foreign key reference to BAR, so a many-to-one relationship
exists.

Foo will contain a getBar() method.  Bar will contain a getFoos(Criteria).

There are several more methods that can get generated depending on
many-to-many
relationships.  So for example if FOO also contains a fk to XXX, then Bar
will contain a
method getFoosJoinXxx(Criteria).  This method will return a collection of
Foos in much the
same way as the getFoos method but the Foo's will be prefilled with their
related Xxx
objects, so that

Vector v = getFoos(c);
loop over v
        print v(i).getXxx().getName();
end loop

Vector v = getFoosJoinXxx(c);
loop over v
        print v(i).getXxx().getName();
end loop

will lead to the exact same listing, the second method will use a join to
grab all the
data at once.  The first method will have one db access to get the Foo's and
then one db
hit per getXxx() method.

John McNally

Steve Grant wrote:
>
> I have the objectModel set to complex in my Torque properties.
>
> I have the XML in the database schema set up for a foreign key.
>
> Is that all I have to do?
>
> What are examples of the join methods that should then emerge in the
Peers?
> Its not obvious to me.
>
> Thanks.
>
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to