org.mybatis.spring.transaction.SpringManagedTransactionFactory Java Examples

The following examples show how to use org.mybatis.spring.transaction.SpringManagedTransactionFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSourceConfiguration.java    From seata-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy)throws Exception{
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
    .getResources("classpath*:/mapper/*.xml"));
    sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return sqlSessionFactoryBean.getObject();
}
 
Example #2
Source File: DataSourceConfiguration.java    From seata-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy)throws Exception{
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
            .getResources("classpath*:/mapper/*.xml"));
    sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return sqlSessionFactoryBean.getObject();
}
 
Example #3
Source File: DataSourceConfiguration.java    From seata-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy)throws Exception{
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
            .getResources("classpath*:/mapper/*.xml"));
    sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return sqlSessionFactoryBean.getObject();
}
 
Example #4
Source File: SeataAutoConfig.java    From seata-samples with Apache License 2.0 5 votes vote down vote up
/**
 * init mybatis sqlSessionFactory
 * @Param: dataSourceProxy  datasource proxy
 * @Return: DataSourceProxy  datasource proxy
 */
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
    SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
    factoryBean.setDataSource(dataSourceProxy);
    factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
            .getResources("classpath*:/mapper/*.xml"));
    factoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return factoryBean.getObject();
}
 
Example #5
Source File: SeataConfiguration.java    From spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
            .getResources("classpath*:/mapper/*.xml"));
    sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return sqlSessionFactoryBean.getObject();
}
 
Example #6
Source File: SeataConfiguration.java    From spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSourceProxy);
    sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
            .getResources("classpath*:/mapper/*.xml"));
    sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
    return sqlSessionFactoryBean.getObject();
}
 
Example #7
Source File: SqlSessionFactoryBean.java    From gocd with Apache License 2.0 5 votes vote down vote up
private SqlSessionFactory buildSqlSessionFactory() throws IOException {
    SqlSessionFactoryBuilder factoryBuilder = new SqlSessionFactoryBuilder();

    XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(configLocation.getInputStream());
    Configuration configuration = xmlConfigBuilder.getConfiguration();
    configuration.setEnvironment(new Environment(getClass().getSimpleName(), new SpringManagedTransactionFactory(), this.dataSource));
    xmlConfigBuilder.parse();
    return factoryBuilder.build(configuration);
}
 
Example #8
Source File: SpringTaskanaEngineImpl.java    From taskana with Apache License 2.0 4 votes vote down vote up
@PostConstruct
public void init() {
  this.transactionFactory = new SpringManagedTransactionFactory();
  this.sessionManager = createSqlSessionManager();
}