use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class MultipleResultTest 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.setMapUnderscoreToCamelCase(true);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(), "org/apache/ibatis/submitted/multiple_resultsets/CreateDB.sql");
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class PostgresGeneratedKeysTest 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.setUseGeneratedKeys(true);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(), "org/apache/ibatis/submitted/postgres_genkeys/CreateDB.sql");
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class BlobInputStreamTypeHandlerTest 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/BlobInputStreamTypeHandlerTest.sql");
}
use of org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory in project mybatis-3 by mybatis.
the class ReverseIncludeTest 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(ReverseIncludePersonMapper.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 EnumWithOgnlTest method testConfiguration.
@Test
void testConfiguration() {
UnpooledDataSourceFactory dataSourceFactory = new UnpooledDataSourceFactory();
Properties dataSourceProperties = new Properties();
dataSourceProperties.put("driver", "org.hsqldb.jdbcDriver");
dataSourceProperties.put("url", "jdbc:hsqldb:mem:xml_references");
dataSourceProperties.put("username", "sa");
dataSourceFactory.setProperties(dataSourceProperties);
Environment environment = new Environment("test", new JdbcTransactionFactory(), dataSourceFactory.getDataSource());
Configuration configuration = new Configuration();
configuration.setEnvironment(environment);
configuration.getTypeAliasRegistry().registerAlias(Person.class);
configuration.addMapper(PersonMapper.class);
configuration.addMapper(PersonMapper2.class);
new DefaultSqlSessionFactory(configuration);
}
Aggregations