Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-3

Transactional Support in connector/jdbc bridge

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Invalid
    • (not version related)
    • (not version related)
    • connectors
    • 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(); }

      }

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--JdbcTransactionalManagedConnectionFactory.java
          6 kB
          Hamilton Verissimo DeOliveira
        2. ASF.LICENSE.NOT.GRANTED--JdbcTransactionalManagedConnection.java
          2 kB
          Hamilton Verissimo DeOliveira
        3. ASF.LICENSE.NOT.GRANTED--ConnectorJdbc.patch
          18 kB
          Hamilton Verissimo DeOliveira

        Activity

          People

            Unassigned Unassigned
            hammett Hamilton Verissimo DeOliveira
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: