0 Replies Latest reply on Apr 24, 2003 11:43 AM by Tommy Eriksson

    Strange CMP Behaviour

    Tommy Eriksson Newbie

      Hi,

      I have a strange CMP behaviour when using jboss 3.2 with postgresql. I use the following code to iterate thourgh a list of sessions.

      public List getAllSessions() throws Exception
      {
      List sessions = new ArrayList();

      Collection userSessions = UserSessionUtil.getHome().findAll();
      Iterator iter = userSessions.iterator();
      for (;iter.hasNext();)
      {
      UserSession sess = (UserSession)iter.next();
      sessions.add(sess.getValue());
      }

      return sessions;
      }

      The thing is that for each iteration a SELECT statment is called for all elements remaing in the list:

      Do anybody have any hints to what I can do to change this behaviour.

      Postgresql log:

      Apr 24 17:37:33 vsm postgres[17371]: [1389-1] DEBUG: query: SELECT id,user_id, touch FROM cn_user_session WHERE (id='yXhR1EU9O9jJ5DYWk1yGyrDsPec9We') OR
      Apr 24 17:37:33 vsm postgres[17371]: [1389-2] (id='bhGUbvEzR7bwxkfmygSc02YFsQo9Sz') OR (id='0pLLiw5niBmR0dBRYD7nPcXTUFQ8sl')
      Apr 24 17:37:33 vsm postgres[17371]: [1412-1] DEBUG: query: SELECT id,user_id, touch FROM cn_user_session WHERE (id='bhGUbvEzR7bwxkfmygSc02YFsQo9Sz') OR
      Apr 24 17:37:33 vsm postgres[17371]: [1412-2] (id='0pLLiw5niBmR0dBRYD7nPcXTUFQ8sl')
      Apr 24 17:37:33 vsm postgres[17371]: [1435] DEBUG: query: SELECT user_id, touch FROM cn_user_session WHERE (id='0pLLiw5niBmR0dBRYD7nPcXTUFQ8sl')