1 Reply Latest reply on Jun 26, 2007 8:44 AM by buggs bunny

    Discution about "Closing a connection for you" and Statefull

    buggs bunny Newbie

      Hello all,

      I want to discuss about the "Closing a connection for you" and Stateful bean.

      The ability to control if connection is not close is really useful, and should be keep since human write code (and can do mistake).
      But when using a container managed transaction in a stateful session bean, this feature is a problem.
      Effectively, if the treatment of the current bean need to be rolled back after many treatment, it's not possible since the connection have been closed after each treatment. We loose the interest of stateful bean!

      I don't know how "Closing a connection for you" is managed and if it's really difficult to adapt it, but it can be useful to keep an association between the stateful bean and it's connection. So until the bean is open, the connection is keeped. At timeout, the connection is closed. Another way, certainly simple is to close connection when ejbClose is called! But closing the connection in a bean managed transaction context is a problem, no?

      This will allow developper to use this feature and be informed that they forget to close connection. This also will ensure the safety of the server!