Java Code Examples for org.mybatis.spring.SqlSessionFactoryBean#setTransactionFactory()

The following examples show how to use org.mybatis.spring.SqlSessionFactoryBean#setTransactionFactory() . 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 JdbcTransactionFactory());
    return factoryBean.getObject();
}
 
Example 5
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 6
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 JdbcTransactionFactory());
    return factoryBean.getObject();
}
 
Example 7
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 8
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 9
Source File: SeataAutoConfig.java    From demo-seata-springcloud with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化mybatis sqlSessionFactory
 * 
 * @param dataSourceProxy
 * @return
 * @throws Exception
 * @author sly
 * @time 2019年6月11日
 */
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
	SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
	factoryBean.setDataSource(dataSourceProxy);
	factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
	factoryBean.setTypeAliasesPackage("com.sly.seata.common.model");
	factoryBean.setTransactionFactory(new JdbcTransactionFactory());
	return factoryBean.getObject();
}
 
Example 10
Source File: SeataAutoConfig.java    From demo-seata-springcloud with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化mybatis sqlSessionFactory
 * 
 * @param dataSourceProxy
 * @return
 * @throws Exception
 * @author sly
 * @time 2019年6月11日
 */
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
	SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
	factoryBean.setDataSource(dataSourceProxy);
	factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
	factoryBean.setTypeAliasesPackage("com.sly.seata.common.model");
	factoryBean.setTransactionFactory(new JdbcTransactionFactory());
	return factoryBean.getObject();
}
 
Example 11
Source File: SeataAutoConfig.java    From demo-seata-springcloud with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化mybatis sqlSessionFactory
 * 
 * @param dataSourceProxy
 * @return
 * @throws Exception
 * @author sly
 * @time 2019年6月11日
 */
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
	SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
	factoryBean.setDataSource(dataSourceProxy);
	factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
	factoryBean.setTypeAliasesPackage("com.sly.seata.common.model");
	factoryBean.setTransactionFactory(new JdbcTransactionFactory());
	return factoryBean.getObject();
}