5 Replies Latest reply on Jul 5, 2005 4:31 AM by tbech

    eager-load-group for CMR doesn't work

    tbech Newbie

      JBoss 3.2.6, default setting in standardjbosscmp-jdbc.xml, commit option A used.
      I observed strange selects for two applications. There is relation A -> many B (unidirectional).

      a.getBs() gives select:
      SELECT LOID FROM B WHERE (A_FK=?)

      and now every entity B is access by fields, it gives:
      SELECT LOID, field1 FROM B WHERE (LOID=?) OR (LOID=?) OR (LOID=?) OR (LOID=?) OR ...

      SELECT LOID, field2 FROM B WHERE (LOID=?) OR (LOID=?) OR (LOID=?) OR (LOID=?) OR ...

      and so on for every field. So obviously read-ahead works and eager-load-group doesn't (no overrried of eager group, using defaul * )

      Even to be sure I tried to set read-ahead for relation:
      <ejb-relation>
      <ejb-relation-name>A2Bs</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>A2Bs:A</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>loid</field-name>
      <column-name>A_FK</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </key-field>
      </key-fields>

      <read-ahead>
      on-load
      <eager-load-group>*</eager-load-group>
      </read-ahead>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>A2Bs:Bs</ejb-relationship-role-name>
      <fk-constraint>true</fk-constraint>
      <key-fields/>

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


      I didn't change the behaviour.
      (by the way loading of main entity A is ok, eager load works properly in this case)
      So could someone explain me what is wrong, and how to make it right?
      (no clues on wiki and jira)