Let's suppose I have this method:
public void doUpdate() throws SQLException
{
java.sql.Connection conn;
java.sql.Statement stmt;
// ...
conn.setAutoCommit(true);
// ...
stmt.executeUpdate(strSQLUpdate);
// ...
}
Since we are using autocommit, the transaction is
committed when we call executeUpdate. Cool.
Here's my question:
What if the caller is using the
Java Transaction API?
Suppose:
public void processRequest()
{
UserTransaction tx;
// ...
tx.begin();
doUpdate();
tx.commit();
}
The caller is demarcating a transaction.
In this scenario, does
JDBC autocommit get ignored?
Does the UserTransaction take precedence over the JDBC transaction?
http://java.sun.com/products/jta/ http://java.sun.com/products/jdbc/