1 Reply Latest reply on Mar 20, 2005 4:45 PM by jobor

    SQL92 and Left-join read-ahead

    jobor

      Hello,

      It is possible that the SQL92 compiler ignores the left-join tags in the jbosscmp-jdbc.xml file.
      If I do a test with a bean A and parent bean B and in a finder method of bean A I specify with a left-join tag that the fields of bean B should also be read from the database an be put in the read-ahead cache.

      It works for the normal compiler. All fields are loaded with just 1 SQL statement. But with the SQL92 compiler the all the fields of bean A are selected from the database and the fields of bean B are then selected from the database with load relation SQL. So with the SQL92 compiler 2 SQL queries are needed.

      Also the 2 queries needed depends on the read-ahead tags in the relation specification in the jbosscmp-jdbc.xml file.

      e.g.

      <ejb-relation>
       <ejb-relation-name>Task-Originator</ejb-relation-name>
       <foreign-key-mapping/>
       <ejb-relationship-role>
       <ejb-relationship-role-name>task-has-originator</ejb-relationship-role-name>
       <key-fields/>
       <read-ahead>
       <strategy>on-find</strategy>
       <eager-load-group>lite</eager-load-group>
       </read-ahead>
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>originator-has-tasks</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>key</field-name>
       <column-name>originator</column-name>
       </key-field>
       </key-fields>
       </ejb-relationship-role>
      </ejb-relation>
      



      T.I.A.

      Johan