use of org.apache.ibatis.session.SqlSessionFactory in project mybatis-3 by mybatis.
the class ResultMapExtendsTest method getSqlSessionFactoryXmlConfig.
private SqlSessionFactory getSqlSessionFactoryXmlConfig() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/ResultMapExtendsMapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Connection conn = sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection();
initDb(conn);
return sqlSessionFactory;
}
use of org.apache.ibatis.session.SqlSessionFactory in project mybatis-3 by mybatis.
the class MultipleCrossIncludeTest method getSqlSessionFactoryXmlConfig.
private SqlSessionFactory getSqlSessionFactoryXmlConfig() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/MultipleCrossIncludeMapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Connection conn = sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection();
initDb(conn);
return sqlSessionFactory;
}
use of org.apache.ibatis.session.SqlSessionFactory in project mybatis-3 by mybatis.
the class MultipleCrossIncludeTest method testMappedStatementCache.
@Test
public void testMappedStatementCache() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/MultipleCrossIncludeMapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Configuration configuration = sqlSessionFactory.getConfiguration();
configuration.getMappedStatementNames();
MappedStatement selectPetStatement = configuration.getMappedStatement("org.apache.ibatis.submitted.xml_external_ref.MultipleCrossIncludePetMapper.select");
MappedStatement selectPersonStatement = configuration.getMappedStatement("org.apache.ibatis.submitted.xml_external_ref.MultipleCrossIncludePersonMapper.select");
Cache cache = selectPetStatement.getCache();
assertEquals("org.apache.ibatis.submitted.xml_external_ref.MultipleCrossIncludePetMapper", cache.getId());
assertSame(cache, selectPersonStatement.getCache());
}
use of org.apache.ibatis.session.SqlSessionFactory in project mybatis-3 by mybatis.
the class ResultMapReferenceTest method getSqlSessionFactoryXmlConfig.
private SqlSessionFactory getSqlSessionFactoryXmlConfig() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/ResultMapReferenceMapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Connection conn = sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection();
initDb(conn);
return sqlSessionFactory;
}
use of org.apache.ibatis.session.SqlSessionFactory in project mybatis-3 by mybatis.
the class SameIdTest method getSqlSessionFactoryXmlConfig.
private SqlSessionFactory getSqlSessionFactoryXmlConfig() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/SameIdMapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Connection conn = sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection();
initDb(conn);
return sqlSessionFactory;
}
Aggregations