2 Replies Latest reply on Oct 6, 2002 7:05 PM by Jack Strohm

    CMP 2.0 read-ahead and cache problems

    Jack Strohm Newbie

      I running Jboss 3.0.1, PostgreSQL 7.2 (debug driver), trying to do a simple CMP 2.0 entity bean. This is the problem I get:

      It seems that every time I call a get method on the bean (the same get method), it hits the database each time. Is there something you need to do to cache the object?

      I'm using commit option 'A' on all my beans.

      Another things that doesn't seem to work is I can't change any of the read-ahead options. I had seen another post where someone said that it had a bug in it. Has that been fixed?

      ------------------------ jsp snippet

      LocalCustomer customer=customerHome.findByPrimaryKey("10IGFJ");

      // NASP is the primary key
      System.out.println("NASP:");
      System.out.println(" "+customer.getNASP());
      System.out.println(" "+customer.getNASP());
      System.out.println(" "+customer.getNASP());
      System.out.println(" "+customer.getNASP());
      System.out.println(" "+customer.getNASP());

      --------------------------- log snippet
      In the log file I get:

      2002-09-16 16:28:11,711 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.ejb/Customer.findByPrimaryKey] Executing SQL: SELECT nasp FROM customer WHERE nasp=?
      2002-09-16 16:28:11,725 INFO [STDOUT] NASP:
      2002-09-16 16:28:11,729 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ejb/Customer] Executing SQL: SELECT name FROM customer WHERE (nasp=?)
      2002-09-16 16:28:11,736 INFO [STDOUT] 10IGFJ
      2002-09-16 16:28:11,737 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ejb/Customer] Executing SQL: SELECT name FROM customer WHERE (nasp=?)
      2002-09-16 16:28:11,742 INFO [STDOUT] 10IGFJ
      2002-09-16 16:28:11,743 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ejb/Customer] Executing SQL: SELECT name FROM customer WHERE (nasp=?)
      2002-09-16 16:28:11,747 INFO [STDOUT] 10IGFJ
      2002-09-16 16:28:11,749 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ejb/Customer] Executing SQL: SELECT name FROM customer WHERE (nasp=?)
      2002-09-16 16:28:11,753 INFO [STDOUT] 10IGFJ
      2002-09-16 16:28:11,755 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ejb/Customer] Executing SQL: SELECT name FROM customer WHERE (nasp=?)
      2002-09-16 16:28:11,762 INFO [STDOUT] 10IGFJ