2 Replies Latest reply on Jun 20, 2003 5:58 AM by rlaenen

    read-ahead strategy

    rlaenen Newbie

      Hi all,

      I'm just trying out the jboss read-ahead strategy for cmp 20 beans and have some strange results.

      I created the following finder method on my customer bean

      <query-method>
      <method-name>findAll_none</method-name>
      <method-params/>
      </query-method>
      <jboss-ql><![CDATA[
      SELECT OBJECT(c)
      FROM Customer c
      ORDER BY c.id
      ]]></jboss-ql>
      <read-ahead>
      on-find
      <page-size>4</page-size>
      <eager-load-group>basic</eager-load-group>
      </read-ahead>


      load group is as follows :

      <load-group>
      <load-group-name>basic</load-group-name>
      <field-name>lastName</field-name>
      <field-name>firstName</field-name>
      <field-name>hasGoodCredit</field-name>
      </load-group>


      When running this query and iterating over the returned collection (5 records are in the table) the following
      statements are sent to the db :

      18:12:45,217 DEBUG [findAll_none] Executing SQL: SELECT t0_c.ID, t0_c.LAST_NAME, t0_c.FIRST_NAME, t0_c.HAS_GOOD_CREDIT, t0_c.ID FROM CUSTOMER t0_c ORDER BY t0_c.ID ASC
      18:12:45,618 DEBUG [CustomerEJB] Executing SQL: SELECT ID,LAST_NAME, FIRST_NAME, HAS_GOOD_CREDIT FROM CUSTOMER WHERE (ID=?) OR (ID=?) OR (ID=?) OR (ID=?)
      18:12:45,769 DEBUG [CustomerEJB] Executing SQL: SELECT ID,LAST_NAME, FIRST_NAME, HAS_GOOD_CREDIT FROM CUSTOMER WHERE (ID=?) OR (ID=?) OR (ID=?) OR (ID=?)
      18:12:45,874 DEBUG [CustomerEJB] Executing SQL: SELECT ID,LAST_NAME, FIRST_NAME, HAS_GOOD_CREDIT FROM CUSTOMER WHERE (ID=?) OR (ID=?) OR (ID=?)
      18:12:45,965 DEBUG [CustomerEJB] Executing SQL: SELECT ID,LAST_NAME, FIRST_NAME, HAS_GOOD_CREDIT FROM CUSTOMER WHERE (ID=?) OR (ID=?)
      18:12:46,060 DEBUG [CustomerEJB] Executing SQL: SELECT LAST_NAME, FIRST_NAME, HAS_GOOD_CREDIT FROM CUSTOMER WHERE (ID=?)

      I expected that after the initial SELECT the preload-cache would be loaded and that the next lookups would retrieve their data from this cache instead of going to the db.

      Can anyone give me a clue on this ???

      tx,

      Roger;