@DirtiesContext @Transactional @Test public void testConnectionNotCommittedWhenTransactionScopeOutsideUnitOfWork() throws Exception { when(dataSource.getConnection()).thenAnswer(invocation -> { fail("Should be using an already existing connection."); return null; }); UnitOfWork<?> uow = DefaultUnitOfWork.startAndGet(null); Connection connection = connectionProvider.getConnection(); connection.commit(); uow.commit(); }
@Override public Connection getConnection() throws SQLException { final Connection connection = DataSourceUtils.doGetConnection(dataSource); return ConnectionWrapperFactory.wrap(connection, closeHandler); }
SpringDataSourceConnectionProvider implements ConnectionProvider { @Override public Connection getConnection() throws SQLException { final Connection connection = DataSourceUtils.doGetConnection(dataSource); return ConnectionWrapperFactory.wrap(connection, closeHandler); } }
SpringDataSourceConnectionProvider implements ConnectionProvider { @Override public Connection getConnection() throws SQLException { final Connection connection = DataSourceUtils.doGetConnection(dataSource); return ConnectionWrapperFactory.wrap(connection, closeHandler); } SpringDataSourceConnectionProvider(DataSource dataSource); }
SpringDataSourceConnectionProvider implements ConnectionProvider { @Override public Connection getConnection() throws SQLException { final Connection connection = DataSourceUtils.doGetConnection(dataSource); return ConnectionWrapperFactory.wrap(connection, closeHandler); } SpringDataSourceConnectionProvider(DataSource dataSource); @Override Connection getConnection(); }
SpringDataSourceConnectionProvider implements ConnectionProvider { @Override public Connection getConnection() throws SQLException { final Connection connection = DataSourceUtils.doGetConnection(dataSource); return ConnectionWrapperFactory.wrap(connection, closeHandler); } SpringDataSourceConnectionProvider(DataSource dataSource); @Override Connection getConnection();  }