3 Replies Latest reply on Jun 5, 2004 5:53 AM by Alexey Loubyansky

    on-find strategy not working

    Tarek Kassem Newbie

      I hava an enity bean named MessageType. I have configuered it in the jbosscmp-jdbc.xml with the read-ahead strategy on-find. with page-size=20.
      when the findAll method is called all the n+1 standard queres are executed.
      the confinguartion in jbosscmp-jdbc.xml is as follows:

      <ejb-name>MessageType</ejb-name>
      <read-only>true</read-only>
      <read-ahead>
      on-find
      <page-size>20</page-size>
      <eager-load-group>*</eager-load-group>
      </read-ahead>
      <table-name>T_MESSAGE_TYPE</table-name>
      <cmp-field>
      <field-name>numMessageTypeID</field-name>
      <column-name>NUM_MESSAGE_TYPE_ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strMessageName</field-name>
      <column-name>STR_MESSAGE_NAME</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strServiceName</field-name>
      <column-name>STR_SERVICE_NAME</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>numCustomerId</field-name>
      <column-name>NUM_CUSTOMER_ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strSchemaLocation</field-name>
      <column-name>STR_SCHEMA_LOCATION</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strReplySchemaLoc</field-name>
      <column-name>STR_REPLY_SCHEMA_LOC</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strStylesheetLocation</field-name>
      <column-name>STR_STYLESHEET_LOCATION</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>strConnectionAddress</field-name>
      <column-name>STR_CONNECTION_ADDRESS</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>numConnectionPort</field-name>
      <column-name>NUM_CONNECTION_PORT</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>numApplyCustomerRules</field-name>
      <column-name>BOOLEAN_APPLY_CUSTOMER_RULES</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>numParentMessageID</field-name>
      <column-name>NUM_PARENT_MESSAGE_ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>numMessageType</field-name>
      <column-name>NUM_MESSAGE_TYPE</column-name>
      </cmp-field>


      and the logs after making the call to findAll as follows:
      2004-06-05 12:02:11,519 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.MessageType#findAll] Executing SQL: SELECT t0_o.NUM_MESSAGE_TYPE_ID, t0_o.STR_MESSAGE_NAME, t0_o.STR_SERVICE_NAME, t0_o.NUM_CUSTOMER_ID, t0_o.STR_SCHEMA_LOCATION, t0_o.STR_REPLY_SCHEMA_LOC, t0_o.STR_STYLESHEET_LOCATION, t0_o.STR_CONNECTION_ADDRESS, t0_o.NUM_CONNECTION_PORT, t0_o.BOOLEAN_APPLY_CUSTOMER_RULES, t0_o.NUM_MESSAGE_TYPE_ID, t0_o.NUM_PARENT_MESSAGE_ID, t0_o.NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE t0_o
      2004-06-05 12:02:11,753 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,222 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,269 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,550 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,597 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,644 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,722 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,784 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,847 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,894 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:12,956 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)
      2004-06-05 12:02:13,003 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MessageType] Executing SQL: SELECT STR_MESSAGE_NAME, STR_SERVICE_NAME, NUM_CUSTOMER_ID, STR_SCHEMA_LOCATION, STR_REPLY_SCHEMA_LOC, STR_STYLESHEET_LOCATION, STR_CONNECTION_ADDRESS, NUM_CONNECTION_PORT, BOOLEAN_APPLY_CUSTOMER_RULES, NUM_PARENT_MESSAGE_ID, NUM_MESSAGE_TYPE FROM T_MESSAGE_TYPE WHERE (NUM_MESSAGE_TYPE_ID=?)


      13 queries are executed and I have 12 rows in the table.
      note: same thing happens for on-load strategy
      Is there is something wrong or is it a bug?
      Plz help