1 Reply Latest reply on Oct 9, 2004 6:03 PM by godboles

    Finder question

    godboles

      Hi all,

      I havea simple CMP bean which stores Customer information. This bean has a transaction attribute of required. It is accessed in a session facade. Every time I call this finder, it executes SQL to retrive the customer. I thought that very first finder would cache the data and the subsequent calls to the finders would be served from this cache instead of accessing the database.

      Is there any way I can avoide this behavior? Any help would be much appreciated. I have purchased and read the Admin docs. But that did not help. Or am I assuming the wrong thing here?

      I am using JDBCOptimistingLocking and a commit option of A.

      The finder defined as follows (xdoclet):

      @ejb.finder
      * query="SELECT DISTINCT OBJECT(c) FROM CUSTOMER as c where c.userID = ?1 AND c.active='Y'"
      * signature="com.customer.CustomerBean findByUserID(java.lang.String userID)"
      *
      * @jboss.query
      * query="SELECT DISTINCT OBJECT(c) FROM CUSTOMER as c where c.userID = ?1 AND c.active='Y'"
      * signature="com.customer.CustomerBean findByUserID(java.lang.String userID)"
      * read-ahead="true"
      * strategy="on-load"
      * page-size="100"


      This finder executes the following SQL every time it is called (same transaction):

      2004-10-09 17:40:47,923 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.Customer#findByUserID] Executing SQL: SELECT DISTINCT t0_c.USER_ID FROM CUSTOMER t0_c WHERE (t0_c.USER_ID = ? AND t0_c.ACTIVE = 'Y')