Title: Multiple to-many relationships.

I have an object that has several to many relationships.  It seems that castor is generating sql that returns all the related data in one query.  But this means if I have a relationship to 4 rows in one table and 5 in another I am getting 20 rows returned from my query.  Unfortunately I will eventually have up to hundred of records in 5 or 6 related tables so I will be getting 10,000 rows returned from the sql statement to initialize the variable (when really only 600 rows were necessary).

Am I doing something wrong or is this how castor is designed?  Here is an abbreviated mapping file:

  <class name="com.pacificorp.grid.domain.project.Project" identity="id" key-generator="ProjectSeq">
  <cache-type type="none" />
    <description>Project</description>
    <map-to table="PROJECT" xml="group" />
    <field name="id" type="integer" >
      <sql name="PROJECTIDN" type="integer"/>
    </field>
    <field name="name" type="string" >
      <sql name="PROJECTNM" type="char"/>
    </field>
    <field name="TransmissionAreas" type="com.pacificorp.grid.domain.topology.TransmissionArea" collection="collection">

      <sql many-key="PROJECTIDN" />
    </field>
    <field name="Links" type="com.pacificorp.grid.domain.topology.Link" collection="collection">
      <sql many-key="PROJECTIDN" />
    </field>
  </class>


Thanks,

Ed Johnson
[EMAIL PROTECTED]

------------------------------------------------------------------------------


This email is confidential and may be legally privileged.

It is intended solely for the addressee. Access to this email by anyone else, unless expressly approved by the sender or an authorized addressee, is unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution or any action omitted or taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender, delete this e-mail and destroy all copies.


==============================================================================

Reply via email to