This one time, at band camp, Franck Routier said:

FR>Mapping file is :
FR>
FR> <class name="ldp.data.Team" identity="Id">
FR>    <description>Equipe</description>
FR>    <map-to table="teams" />
FR>    <field name="Id" type="integer" >
FR>      <sql name="id" type="integer"/>
FR>    </field>
FR>    <field name="Name" type="string">
FR>      <sql name="name" type="char"/>
FR>    </field>
FR>    <field name="Mhome" type="ldp.data.Match" collection="collection">
FR>      <sql many-key="home"/>
FR>    </field>
FR>    <field name="Mvisit" type="ldp.data.Match" collection="collection">
FR>      <sql many-key="visitor"/>
FR>    </field>
FR>  </class>
FR>
FR> <class name="ldp.data.Match" identity="Id">
FR>    <description>Match</description>
FR>    <map-to table="matches" />
FR>    <field name="Id" type="integer" >
FR>      <sql name="id" type="integer"/>
FR>    </field>
FR>    <field name="Home" type="ldp.data.Equipe">
FR>      <sql name="home"/>
FR>    </field>
FR>    <field name="Visitor" type="ldp.data.Equipe">
FR>      <sql name="visitor"/>
FR>    </field>
FR>  </class>
FR>

Franck,

Using two separate collections and forcing Castor to do mulitple
outer joins on the same table twice in the same query is not going
to work (as you've already seen).

This is a difficult problem to solve because what you're really
trying to do is join on two object instances where the objects are
both of type Team. This is simply my opinion in terms of using
Castor so take or leave it.

If this were my problem to solve first, I would actually only use
one collection because you're really fetching the same data twice
just sorting it different each time. Then I would sort that Collection
in your application code using either the mhome field or the mvisitor
field, depending on the scenario. My resoning for this is that it
seems as if you're trying to accomplish business logic via the
database rather than via your application.

Again, this is only my opinion. Oftentimes I've seen scenarios posed
similar to this one. In fact, I've even done it myself. In these
cases, because you're using object-relational mapping, you need to
approach the problem from a different angle.

Bruce
--

perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to