Hi
All,
I have a doubt
regarding the Transaction and Connection handling of EJB
Containers.
I have a Session
Facade (Stateless Session Bean) which has a method updateCustomer() and I am
setting the TXN attrib of this method in my Session facade as "REQUIRED". Now
this method is creating the instances of few other Business Objects. Now each of
these Business Objects are creating the instances of their corresponding DAOs
which are creating their own connection(From
javax.sql.DataSource.getConnection(). The DataSource is obtained through JNDI
lookup).
The first DAO
performs database operations and returns the connection back to the connection
pool, WITHOUT EITHER COMMITTING OR ROLLING BACK the
transaction.
The second DAO
also performs a DataSource.getConnection() request and does some database
transactions.
Now my question is
whether the REQUIRED attribute set for the Sesion Facade method will propogate
down to the DAO methods.i.e..if I call a setRollBackOnly() from the
updateCustomer() of my session bean, will the entire transaction be rolled
back....
I read from a user
forum that under the same transaction, say the first object obtains a
connection and returns it to the pool...but transaction not committed or rolled
back...then if a second object calls DataSource.getConnection(), the container
will pass a wrapper to the old connection itself...making it effectively same
connection underneath. Is this true???
Can sobebody
suggest the best place to place the connection obtaining and returing
statements.
Thanks &
Regards
Jaise
Thanks &
Regards
Jaise
