2 Replies Latest reply on May 20, 2004 2:22 PM by Roger Tan

    How many connections will be created if I do the following ?

    Roger Tan Newbie

      I am reading a very large result set and will be updating them as part of a separate action ( in a different transaction ). Everything will be driven through an MBean so basically here's the pseudocode:

      1. do a select through a DAO which will return an iterator that will keep
      track of the connection and result set ( they will be closed
      automatically when Iterator.hasNext() returns false )

      2. I want to process each row of the Iterator as part of an action
      ( a method in a session bean ) that should be in its own transaction (
      setting the appropriate transaction setting for the session bean ).

      As such I would need connection obtained through 1 and 2 to be different. I'll be getting a connection through dataSource.getConnection(). I know that containers will sometimes use ThreadLocal to keep track of connection, so in this case would my logic work ? Thanks.