Could someone clear something up for me
Say I get a
JDBC connection from a Datasource (accessed via JNDI) in a Session Bean method that is running inside a Container managed Transaction.
I've read in an earlierpost that the JDBC operations, update etc will be automatically part of the current transaction if you are running under CMT. So rollbacks, commits will apply to these JDBC operations.
Is this correct?
If so where does setAutoCommit(true/false) on the connection come into play in this scenario.
Is the connection acquired with Autocommit false?
What happens if I make it set to true, won't this cause the JDBC operations to be committed irrespective of the Session Transaction status??
Finally in BMT does issuing
UserTransaction ut = context.getUserTransaction();
Mean that acquiring a connection via
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection();
Mean that the JDBC connection is automatically participating in the UserTransaction???
Do you have to issue a begin() on the User Transaction PRIOR to acquring the Connection or doesn't it matter??
Phew my head hurts! Thanks to anyone who helps or can point me in the direction of some succinct article