0 Replies Latest reply on Jan 3, 2003 5:51 PM by javahead

    CMP/CMR 1-many generating 2 SQL calls on findByPrimaryKey

    javahead

      Greetings,

      I tried to post earlier but it didn't take. So, if this shows up twice - sorry. Calling findByPrimaryKey on the SalesOrder EJB (relationship shown below) is generating two SQL calls: select to load sales order and select to load the line items. I'd like one select to load the sales order and its line items on a call to the sales order findByPrimaryKey. I'm sure that I am probably missing something simple. The deployment descriptors are generated by XDoclet and the beans are CMP in the default CMP 2.x container w/oracle 8.1.7.

      Thanks!

      <ejb-relation>
      <ejb-relation-name>SalesOrder-LineItem</ejb-relation-name>

      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>one-SalesOrder-has-many-LineItems</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>sO_HDR_NO</field-name>
      <column-name>SO_HDR_NO</column-name>
      </key-field>
      </key-fields>

      <read-ahead>
      on-find
      <page-size>50</page-size>
      <eager-load-group>*</eager-load-group>
      </read-ahead>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>one-LineItem-belongs-to-one-SalesOrder</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      </ejb-relation>