假设我的代码大致类似于这样:(使用 oracle 10G jdbc)。在这种特定场景下会提交事务吗?
public void someMethod(){
try {
OracleConnection connection = getConnectionFromPool();
connection.setAutoCommit(false);
// Do some transaction here - complete transaction, no errors occurred
...
//Throw my own exception here
throw new Exception("Custom Exception");
} catch (Exception e}
{
...
}
finally {
connection.setAutoCommit(true);
}
}