use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class RefCursorTest method setUp.
@BeforeAll
static void setUp() throws Exception {
Configuration configuration = new Configuration();
Environment environment = new Environment("development", new JdbcTransactionFactory(), PgContainer.getUnpooledDataSource());
configuration.setEnvironment(environment);
configuration.addMapper(OrdersMapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(), "org/apache/ibatis/submitted/refcursor/CreateDB.sql");
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class AutoMappingUnknownColumnBehaviorTest 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.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class ManyAnnoTest method testGetMessageForEmptyDatabase.
@Test
void testGetMessageForEmptyDatabase() throws Exception {
final Environment environment = new Environment("test", new JdbcTransactionFactory(), BaseDataTest.createBlogDataSource());
final Configuration config = new Configuration(environment);
config.addMapper(PostMapper.class);
final SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(config);
try (SqlSession session = factory.openSession()) {
PostMapper mapper = session.getMapper(PostMapper.class);
List<AnnoPost> posts = mapper.getPosts(101);
assertEquals(3, posts.size());
assertEquals(3, posts.get(0).getTags().size());
assertEquals(1, posts.get(1).getTags().size());
assertEquals(0, posts.get(2).getTags().size());
}
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class MultipleCrossIncludeTest method getSqlSessionFactoryJavaConfig.
private SqlSessionFactory getSqlSessionFactoryJavaConfig() throws Exception {
Configuration configuration = new Configuration();
Environment environment = new Environment("development", new JdbcTransactionFactory(), new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:xmlextref", null));
configuration.setEnvironment(environment);
configuration.addMapper(MultipleCrossIncludePersonMapper.class);
configuration.addMapper(MultipleCrossIncludePetMapper.class);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
initDb(sqlSessionFactory);
return sqlSessionFactory;
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class MultipleIncludeTest method getSqlSessionFactoryJavaConfig.
private SqlSessionFactory getSqlSessionFactoryJavaConfig() throws Exception {
Configuration configuration = new Configuration();
Environment environment = new Environment("development", new JdbcTransactionFactory(), new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:xmlextref", null));
configuration.setEnvironment(environment);
configuration.addMapper(MultipleIncludePersonMapper.class);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
initDb(sqlSessionFactory);
return sqlSessionFactory;
}
Aggregations