Example usage for org.apache.commons.dbcp PoolableConnectionFactory setDefaultAutoCommit

List of usage examples for org.apache.commons.dbcp PoolableConnectionFactory setDefaultAutoCommit

Introduction

In this page you can find the example usage for org.apache.commons.dbcp PoolableConnectionFactory setDefaultAutoCommit.

Prototype

public void setDefaultAutoCommit(boolean defaultAutoCommit) 

Source Link

Document

Sets the default "auto commit" setting for borrowed Connection s

Usage

From source file:org.artifactory.storage.db.itest.spring.DbTestConfigFactory.java

@Bean(name = "dataSource")
public DataSource createDataSource() {
    StorageProperties storageProperties = beanFactory.getBean("storageProperties", StorageProperties.class);
    ArtifactoryDataSource dataSource = new ArtifactoryDataSource(storageProperties);
    GenericObjectPool pool = (GenericObjectPool) ReflectionTestUtils.getField(dataSource, "_pool");
    PoolableConnectionFactory factory = (PoolableConnectionFactory) ReflectionTestUtils.getField(pool,
            "_factory");
    factory.setDefaultAutoCommit(true);
    return dataSource;
}