Search in sources :

Example 21 with UnpooledDataSource

use of org.apache.ibatis.datasource.unpooled.UnpooledDataSource in project mybatis-3 by mybatis.

the class ResultMapExtendsTest 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(ResultMapReferencePersonMapper.class);
    configuration.addMapper(ResultMapReferencePetMapper.class);
    SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
    initDb(sqlSessionFactory);
    return sqlSessionFactory;
}
Also used : UnpooledDataSource(org.apache.ibatis.datasource.unpooled.UnpooledDataSource) Configuration(org.apache.ibatis.session.Configuration) SqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory) Environment(org.apache.ibatis.mapping.Environment) SqlSessionFactoryBuilder(org.apache.ibatis.session.SqlSessionFactoryBuilder) JdbcTransactionFactory(org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory)

Aggregations

UnpooledDataSource (org.apache.ibatis.datasource.unpooled.UnpooledDataSource)21 Configuration (org.apache.ibatis.session.Configuration)17 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)17 Environment (org.apache.ibatis.mapping.Environment)14 JdbcTransactionFactory (org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory)14 SqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory)13 Properties (java.util.Properties)7 Test (org.junit.jupiter.api.Test)6 Reader (java.io.Reader)4 SqlSession (org.apache.ibatis.session.SqlSession)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 InputStream (java.io.InputStream)1 DataSource (javax.sql.DataSource)1 BaseDataTest (org.apache.ibatis.BaseDataTest)1 CustomLongTypeHandler (org.apache.ibatis.builder.CustomLongTypeHandler)1 CustomObjectWrapperFactory (org.apache.ibatis.builder.CustomObjectWrapperFactory)1 CustomReflectorFactory (org.apache.ibatis.builder.CustomReflectorFactory)1 CustomStringTypeHandler (org.apache.ibatis.builder.CustomStringTypeHandler)1 ExampleObjectFactory (org.apache.ibatis.builder.ExampleObjectFactory)1