use of org.apache.ibatis.transaction.TransactionFactory in project mybatis-3 by mybatis.
the class ClobReaderTypeHandlerTest method setupSqlSessionFactory.
@BeforeAll
static void setupSqlSessionFactory() throws Exception {
DataSource dataSource = BaseDataTest.createUnpooledDataSource("org/apache/ibatis/type/jdbc.properties");
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(), "org/apache/ibatis/type/ClobReaderTypeHandlerTest.sql");
}
use of org.apache.ibatis.transaction.TransactionFactory in project mybatis-3 by mybatis.
the class FlushTest method setup.
@BeforeAll
static void setup() throws Exception {
DataSource dataSource = BaseDataTest.createBlogDataSource();
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.setDefaultExecutorType(ExecutorType.BATCH);
configuration.getTypeAliasRegistry().registerAlias(Post.class);
configuration.getTypeAliasRegistry().registerAlias(Author.class);
configuration.addMapper(BoundAuthorMapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
use of org.apache.ibatis.transaction.TransactionFactory in project mybatis-3 by mybatis.
the class MapperMethodParamTest method setup.
@BeforeAll
static void setup() throws Exception {
DataSource dataSource = BaseDataTest.createUnpooledDataSource(BaseDataTest.BLOG_PROPERTIES);
BaseDataTest.runScript(dataSource, "org/apache/ibatis/binding/paramtest-schema.sql");
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
use of org.apache.ibatis.transaction.TransactionFactory in project mapping-benchmark by arnaudroger.
the class SqlSessionFact method getSqlSessionFactory.
public static SqlSessionFactory getSqlSessionFactory(ConnectionParam connParam) {
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, connParam.dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(DbObjectMapper.class);
SqlSessionFactory sqlSession = new SqlSessionFactoryBuilder().build(configuration);
return sqlSession;
}
use of org.apache.ibatis.transaction.TransactionFactory in project mybatis-3 by mybatis.
the class BindingTest method setup.
@BeforeAll
static void setup() throws Exception {
DataSource dataSource = BaseDataTest.createBlogDataSource();
BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DDL);
BaseDataTest.runScript(dataSource, BaseDataTest.BLOG_DATA);
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.setLazyLoadingEnabled(true);
// to test legacy style reference (#{0} #{1})
configuration.setUseActualParamName(false);
configuration.getTypeAliasRegistry().registerAlias(Blog.class);
configuration.getTypeAliasRegistry().registerAlias(Post.class);
configuration.getTypeAliasRegistry().registerAlias(Author.class);
configuration.addMapper(BoundBlogMapper.class);
configuration.addMapper(BoundAuthorMapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
Aggregations