Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Description
Currently, XAManagedConnection does not implement the LocalTransaction interface. As a result the following conditions produces an error:
@TransactionDemarcation(NotSupported)
public void doSomething()
{
DataSource ds = ... (XADataSource)
Connection c = ds.getConnection();
c.setAutoCommit(false); // NOT Managed transaction
// do stuff
throw EJBException("Container/JCA should rollback uncommitted
transaction!");
}
Because of the c.setAutoCommit(false), a LocalTransaction is started. When the EJBException is thrown, the transaction is left hanging. Typically this is handled in the TxConnectionEventListener for LocalManagedConnection. However, in the case of XAManagedConnection the get mc.getLocalTransaction() throws a ResourceException and the transaction is never rolled back.