0 Replies Latest reply on May 31, 2006 4:48 AM by qq2kk

    JDBCLoadEntityCommand - Repeating SQL execution

    qq2kk

      Hello guys

      Sorry if I posted to the wrong category.

      I have been googling for an answer for 2 days with no luck.
      I'm new to Jboss & Ejb and asked to debug an ejb application :( .

      I found that the application is too slow due to repeat executing the same SQL query:

      (extracted from server.log)

      2006-05-31 18:30:42,357 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.UserLog] Executing SQL: SELECT location, action, serial, logged FROM krypton_log_user WHERE (id=?)
      2006-05-31 18:30:42,358 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.UserLog] Executing SQL: SELECT location, action, serial, logged FROM krypton_log_user WHERE (id=?)
      2006-05-31 18:30:42,360 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.UserLog] Executing SQL: SELECT location, action, serial, logged FROM krypton_log_user WHERE (id=?)
      ... a lot more...
      

      Here are what I have in Java.

      UserLogBean.Java:
       * @ejb.bean name="UserLog" jndi-name="krypton/log/UserLog" local-jndi-name="krypton/log/UserLogLocal"
      
       * @ejb.persistence table-name="krypton_log_user"
      
       * @ejb.util generate="physical"
      
       *
      
       * @ejb.finder role-name="user" signature="java.util.Collection findByKioskDateRange(java.lang.String kiosk, java.util.Date start, java.util.Date end)" query="SELECT OBJECT(log) FROM UserLog AS log WHERE log.kioskSerial=?1 AND log.logged > ?2 AND log.logged < ?3 ORDER BY log.logged"
      


      Report.java:
      Collection entries = this.findLogEntries(kiosk, day.getTime(), end.getTime());
      Iterator it = entries.iterator();
      while (it.hasNext()) {
      
       UserLog entry = (UserLog)it.next();
      
       System.out.println("entry.getDate() = "+entry.getDate());
       ...
      }
      


      The problem is that JBoss would execute the above SQL whenever I want to get the value of an attribute of [UserLog].

      How do I solve this problem?

      JBoss: jboss-3.2.5 + xdoclet

      Great thanks!
      Ming