Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Invalid
-
(not version related)
-
None
Description
Tested with geronimo implementation and Oracle database. Follows my test code:
public class Main implements ManagedConnectionFactoryListener
{
public Main() throws Exception
{
TransactionManagerImpl transactionManager = new TransactionManagerImpl();
ContainerTransactionContext transactionContext =
new ContainerTransactionContext(transactionManager);
TransactionContext.setContext(transactionContext);
ConnectionTrackingCoordinator ctc = new ConnectionTrackingCoordinator();
ConnectionManagerDeployment cmd =
new ConnectionManagerDeployment(true, false, true, true, true, 10, 1000 * 60, new MyRealmBridge(), ctc);
cmd.doStart();
ManagedConnectionFactoryWrapper mcf = new ManagedConnectionFactoryWrapper(
JdbcTransactionalManagedConnectionFactory.class,
DataSource.class,
JdbcConnectionFactory.class,
JdbcConnection.class,
null,
"Nome",
null,
cmd,
this);
mcf.doStart();
transactionContext.begin();
DataSource cf = (DataSource) mcf.getProxy();
Connection conn = cf.getConnection();
Statement stmt = conn.createStatement();
stmt.execute("Delete from LOG_ATUALIZACAO");
stmt.close();
conn.close();
mcf.doStop();
transactionContext.commit();
}
public void setManagedConnectionFactory(ManagedConnectionFactory managedConnectionFactory)
{
if ( managedConnectionFactory == null )
JdbcTransactionalManagedConnectionFactory conn =
(JdbcTransactionalManagedConnectionFactory) managedConnectionFactory;
try
{ conn.setXADataSourceClass( "oracle.jdbc.xa.client.OracleXADataSource" ); conn.setDefaultUserName(".."); conn.setDefaultPassword(".."); conn.setJdbcUrl("jdbc:oracle:thin:@..."); }catch(Exception ex)
{ ex.printStackTrace(); }}