OpenEJB
  1. OpenEJB
  2. OPENEJB-3

Transactional Support in connector/jdbc bridge

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: (not version related)
    • Fix Version/s: (not version related)
    • Component/s: connectors
    • Labels:
      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 )

      { return; }

      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(); }

      }

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            hamilton verissimo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved:

              Development