Examples of ConnectionHandle


Examples of org.springframework.jdbc.datasource.ConnectionHandle

        txObject.getPersistenceManagerHolder().setTimeoutInSeconds(timeout);
      }

      // Register the JDO PersistenceManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJdoDialect().getJdbcConnection(pm, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

        txObject.getEntityManagerHolder().setTimeoutInSeconds(timeout);
      }

      // Register the JPA EntityManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJpaDialect().getJdbcConnection(em, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

        txObject.getPersistenceManagerHolder().setTimeoutInSeconds(timeout);
      }

      // Register the JDO PersistenceManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJdoDialect().getJdbcConnection(pm, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

    final DataSource ds = (DataSource) dsControl.getMock();
    MockControl dialectControl = MockControl.createControl(JdoDialect.class);
    JdoDialect dialect = (JdoDialect) dialectControl.getMock();
    MockControl conControl = MockControl.createControl(Connection.class);
    final Connection con = (Connection) conControl.getMock();
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);

    pmf.getPersistenceManager();
    pmfControl.setReturnValue(pm, 1);
    pm.currentTransaction();
    pmControl.setReturnValue(tx, 3);
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

    final DataSource ds = (DataSource) dsControl.getMock();
    MockControl dialectControl = MockControl.createControl(JdoDialect.class);
    JdoDialect dialect = (JdoDialect) dialectControl.getMock();
    MockControl conControl = MockControl.createControl(Connection.class);
    final Connection con = (Connection) conControl.getMock();
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);

    pmfControl.reset();
    pmf.getConnectionFactory();
    pmfControl.setReturnValue(ds, 2);
    con.getMetaData();
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

    conControl.setVoidCallable(1);
    final TransactionTemplate tt = new TransactionTemplate();
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
    dialect.beginTransaction(tx, tt);
    dialectControl.setReturnValue(null, 1);
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);
    dialect.getJdbcConnection(pm, false);
    dialectControl.setReturnValue(conHandle, 1);
    dialect.releaseJdbcConnection(conHandle, pm);
    dialectControl.setVoidCallable(1);
    dialect.cleanupTransaction(null);
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

        txObject.getEntityManagerHolder().setTimeoutInSeconds(timeoutToUse);
      }

      // Register the JPA EntityManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJpaDialect().getJdbcConnection(em, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeoutToUse != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeoutToUse);
          }
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

  @Test
  public void testTransactionCommitWithDataSource() throws SQLException {
    final DataSource ds = mock(DataSource.class);
    JdoDialect dialect = mock(JdoDialect.class);
    final Connection con = mock(Connection.class);
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);

    given(pmf.getPersistenceManager()).willReturn(pm);
    given(pm.currentTransaction()).willReturn(tx);
    TransactionTemplate tt = new TransactionTemplate();
    given(dialect.getJdbcConnection(pm, false)).willReturn(conHandle);
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

  @Test
  public void testTransactionCommitWithAutoDetectedDataSource() throws SQLException {
    final DataSource ds = mock(DataSource.class);
    JdoDialect dialect = mock(JdoDialect.class);
    final Connection con = mock(Connection.class);
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);

    given(pmf.getConnectionFactory()).willReturn(ds);
    given(pmf.getPersistenceManager()).willReturn(pm);
    given(pm.currentTransaction()).willReturn(tx);
    TransactionTemplate tt = new TransactionTemplate();
View Full Code Here

Examples of org.springframework.jdbc.datasource.ConnectionHandle

    given(md.supportsSavepoints()).willReturn(true);
    given(con.getMetaData()).willReturn(md);
    given(con.setSavepoint(ConnectionHolder.SAVEPOINT_NAME_PREFIX + 1)).willReturn(sp);
    final TransactionTemplate tt = new TransactionTemplate();
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
    ConnectionHandle conHandle = new SimpleConnectionHandle(con);
    given(dialect.getJdbcConnection(pm, false)).willReturn(conHandle);
    given(tx.isActive()).willReturn(!manualSavepoint);

    JdoTransactionManager tm = new JdoTransactionManager();
    tm.setNestedTransactionAllowed(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.