2 Replies Latest reply on Sep 3, 2003 7:43 AM by frank_ulbricht

    No cahcing in Collections?

    frank_ulbricht

      If have an EntityBean with a finder method (Collection findByUserId(Long userId), remote interface). From a JSP I call the finder and use an Interator to walk through the returned collection. Then I invoke some getters on the collection items. It takes extremly long (even with a few records). This is what is noticed in the log files:

      This query is performed when I invoke the finder: "SELECT t0_a.ID FROM LOGENTRIES t0_a WHERE t0_a.USER_ID = ?" It looks correct.

      When I call a getter, EVERYTIME!! this query is performed: "SELECT ID,USER_ID, ENTRY_TIME, ACTION FROM LOGENTRIES WHERE (ID=?) OR (ID=?) OR (ID=?) OR (ID=?) OR (ID=?) OR ..." It looks like the collection items are loaded from the database. But why is it done every time when I invoke a getter, even from the same bean? I noticed that the count of the "OR (ID=?)" fragments seams to be the remaining count of items in the collection. So the count of "OR (ID=?)" fragments is decreased when I use the next bean returned by the iterator.

      Anyone any idea?