Hi,
I have a general doubt in stateless session beans.
Manning in Action for EJB3 states that "The
JDBC connection object used to create the statement is a classic heavy duty resource. It is expensive to open and should be shared across cals wherever possible".
It further goes on to mention that connection should be opened in PostConstruct and closed in Predestroy callbacks methods of the bean.
However, i think closing the connection is equivalent to committing the transaction(not sure if it is right).
That way, do the transactions are committed only when the bean is destroyed(this is not true, so the above statement must be wrong).
Can someone shed some light on the above.
Also, if we have 10 stateless beans in the pool, in the method ready state, all of them will have opened the DB connections(if the connections are opened in PostConstruct).
Wouldn't it be undesirable because there are 10 open connections with the DB, when none of the transaction is active.
Please let me know.