In Sun's EJB Developer's guide, I found the following:


> Longterm Connections
> You can design an enterprise bean that holds a database connection for its entire 
>lifetime. Because the bean connects and >
disconnects just once, its code is slightly easier to write. But there's a tradeoff-- 
other enterprise beans may not >
acquire the connection. Session and entity beans issue the lifelong connections in 
different methods.
>
> Session Beans
> The EJB container invokes the ejbCreate method at the beginning of a session bean's 
>life cycle, and invokes the ejbRemove >
method at the end. To retain a connection for the lifetime of a session bean, you 
connect to the database in ejbCreate and >
disconnect in ejbRemove. If the session bean is stateful, you must also connect in 
ejbActivate and disconnect in >
ejbPassivate. A stateful session bean requires these additional calls because the EJB 
container may passivate the bean >
during its lifetime. During passivation, a stateful session bean is saved in secondary 
storage, but a database connection >
may not be saved in this manner. Because a stateless session bean cannot be 
passivated, it does not require the additional >
calls in ejbActivate and ejbPassivate. For more information on activation and 
passivation, see the section, "The Life Cycle >
of a Session Bean". For an example of a stateful session bean with a longterm 
connection, see the TellerEJB.java code.


I want to make a stateless session bean that holds it's connections and 
CallableStatements across method invocations (Each
client calls many of the methods, and each method does only a call to a stored 
procedure. So this should lead to improved
per-client performance, but poor over-all performance). I tried what is said above in 
my bean. It does not work. JOnAS tells
me, that after the call, the conn.close() is missing (XASTART without XAEnd and so on. 
"Force a physical close...").

Is there a trick what I have to do to make this run? Or is JOnAS not wanted to run 
such beans? Or is it a bug (any idea where
I can look to fix it)?

Thank you
Markus

P.S.: I found similar case in mailing list archive, but could not locate a solution 
there.

Reply via email to