Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.SimpleConnectionHandle


    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


  @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

  @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

    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

  public ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean readOnly)
      throws PersistenceException, SQLException {

    Session session = getSession(entityManager);
    Connection con = session.connection();
    return (con != null ? new SimpleConnectionHandle(con) : null);
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.SimpleConnectionHandle

Copyright © 2018 www.massapicom. 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.