Package net.hasor.db.jdbc.core

Examples of net.hasor.db.jdbc.core.JdbcTemplateProvider


    }
    protected void configDataSource(ApiBinder apiBinder, DataSource dataSource, String dsName) throws Throwable {
        //1.绑定DataSource接口实现
        apiBinder.bindType(DataSource.class).nameWith(dsName).toInstance(dataSource);
        //2.绑定JdbcTemplate接口实现
        apiBinder.bindType(JdbcTemplate.class).nameWith(dsName).toProvider(new JdbcTemplateProvider(dataSource));
        apiBinder.bindType(JdbcTemplate.class).idWith(dsName).toProvider(new JdbcTemplateProvider(dataSource));
        //3.启用默认事务拦截器
        apiBinder.installModule(new SimpleTranInterceptorModule(dataSource));
    }
View Full Code Here


        //2.创建数据库连接池
        DataSource dataSource = C3p0DataSourceFactory.createDataSource(driverString, urlString, userString, pwdString);
        //3.绑定DataSource接口实现
        apiBinder.bindType(DataSource.class).toInstance(dataSource);
        //4.绑定JdbcTemplate接口实现
        apiBinder.bindType(JdbcTemplate.class).toProvider(new JdbcTemplateProvider(dataSource));
        //5.启用默认事务拦截器
        apiBinder.installModule(new SimpleTranInterceptorModule(dataSource));
    }
View Full Code Here

    //
    public void loadModule(ApiBinder apiBinder) throws Throwable {
        //1.绑定DataSource接口实现
        apiBinder.bindType(DataSource.class).idWith(this.dataSourceID).toInstance(this.dataSource);
        //2.绑定JdbcTemplate接口实现
        apiBinder.bindType(JdbcTemplate.class).toProvider(new JdbcTemplateProvider(this.dataSource));
        //3.启用默认事务拦截器
        apiBinder.installModule(new SimpleTranInterceptorModule(this.dataSource));
    }
View Full Code Here

TOP

Related Classes of net.hasor.db.jdbc.core.JdbcTemplateProvider

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.