use of org.apache.ibatis.session.defaults.DefaultSqlSessionFactory in project mybatis-3 by mybatis.
the class NpeExtendsTest method getSqlSessionFactoryWithConstructor.
private SqlSessionFactory getSqlSessionFactoryWithConstructor() {
UnpooledDataSourceFactory unpooledDataSourceFactory = new UnpooledDataSourceFactory();
Properties properties = new Properties();
properties.setProperty("driver", "org.hsqldb.jdbcDriver");
properties.setProperty("url", "jdbc:hsqldb:mem:extends_with_constructor");
properties.setProperty("username", "sa");
unpooledDataSourceFactory.setProperties(properties);
Environment environment = new Environment("extends_with_constructor", new JdbcTransactionFactory(), unpooledDataSourceFactory.getDataSource());
Configuration configuration = new Configuration();
configuration.setEnvironment(environment);
configuration.addMapper(StudentConstructorMapper.class);
configuration.addMapper(TeacherMapper.class);
configuration.getMappedStatementNames();
configuration.setAutoMappingBehavior(AutoMappingBehavior.NONE);
return new DefaultSqlSessionFactory(configuration);
}
use of org.apache.ibatis.session.defaults.DefaultSqlSessionFactory in project mybatis-3 by mybatis.
the class ProviderTest method shouldUseDefaultId.
@Test
public void shouldUseDefaultId() throws Exception {
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/multidb/MultiDbConfig.xml");
DefaultSqlSessionFactory sqlSessionFactory = (DefaultSqlSessionFactory) new SqlSessionFactoryBuilder().build(reader);
Configuration c = sqlSessionFactory.getConfiguration();
assertEquals("hsql", c.getDatabaseId());
}
Aggregations