当前位置: 首页>>代码示例>>Java>>正文


Java SqlSessionFactoryBuilder.build方法代码示例

本文整理汇总了Java中org.apache.ibatis.session.SqlSessionFactoryBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java SqlSessionFactoryBuilder.build方法的具体用法?Java SqlSessionFactoryBuilder.build怎么用?Java SqlSessionFactoryBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ibatis.session.SqlSessionFactoryBuilder的用法示例。


在下文中一共展示了SqlSessionFactoryBuilder.build方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldDemonstrateDuplicateResourceIssue

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
@Test
public void shouldDemonstrateDuplicateResourceIssue() throws Exception {
  final String resource = "org/apache/ibatis/submitted/duplicate_resource_loaded/Config.xml";
  final Reader reader = Resources.getResourceAsReader(resource);
  final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  final SqlSessionFactory factory = builder.build(reader);
  final SqlSession sqlSession = factory.openSession();
  try {
    final Mapper mapper = sqlSession.getMapper(Mapper.class);
    final List<Map<String, Object>> list = mapper.selectAllBlogs();
    Assert.assertEquals(2,list.size());
  } finally {
    sqlSession.close();
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:16,代码来源:DuplicateResourceTest.java

示例2: init

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
/**
 * 初始化链接mariadb
 * 
 * @param configDir
 *            地址
 * @param configName
 *            配置文件名
 * @param log
 *            日志可为null
 * @throws Exception
 */
public static void init(String configDir, String configName, ILog log) throws Exception {
	if (configDir == null || configDir.equals("")) {
		throw new Exception("配置文件信息为空");
	}
	MybatisManager.log = log;
	if (!configDir.endsWith("/") && !configDir.endsWith("\\")) {
		configDir += "/";
	}
	String xmlPath = configDir + configName;
	InputStream inputStream = new FileInputStream(xmlPath);
	SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
	sqlSessionFactory = builder.build(inputStream);
}
 
开发者ID:dianbaer,项目名称:grain,代码行数:25,代码来源:MybatisManager.java

示例3: testExternalRefAfterSelectKey

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
@Test
public void testExternalRefAfterSelectKey() throws Exception {
  String resource = "org/apache/ibatis/submitted/refid_resolution/ExternalMapperConfig.xml";
  Reader reader = Resources.getResourceAsReader(resource);
  SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  SqlSessionFactory sqlSessionFactory = builder.build(reader);
  reader.close();
  sqlSessionFactory.getConfiguration().getMappedStatementNames();
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:10,代码来源:ExternalRefidResolutionTest.java

示例4: testIncludes

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
@Test(expected = PersistenceException.class)
public void testIncludes() throws Exception {
  String resource = "org/apache/ibatis/submitted/refid_resolution/MapperConfig.xml";
  Reader reader = Resources.getResourceAsReader(resource);
  SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  SqlSessionFactory sqlSessionFactory = builder.build(reader);
  sqlSessionFactory.getConfiguration().getMappedStatementNames();
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:9,代码来源:RefidResolutionTest.java

示例5: testSelectKey

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
@Test
public void testSelectKey() throws Exception {
  // this test checks to make sure that we can have select keys with the same
  // insert id in different namespaces
  String resource = "org/apache/ibatis/submitted/selectkey/MapperConfig.xml";
  Reader reader = Resources.getResourceAsReader(resource);
  SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  SqlSessionFactory sqlMapper = builder.build(reader);
  assertNotNull(sqlMapper);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:11,代码来源:SelectKeyTest.java

示例6: shouldParseMapWithIntegerJdbcType

import org.apache.ibatis.session.SqlSessionFactoryBuilder; //导入方法依赖的package包/类
@Test
public void shouldParseMapWithIntegerJdbcType() throws Exception {
  String resource = "org/apache/ibatis/submitted/integer_enum/MapperConfig.xml";
  Reader reader = Resources.getResourceAsReader(resource);
  SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
  builder.build(reader);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:8,代码来源:IntegerEnumTest.java


注:本文中的org.apache.ibatis.session.SqlSessionFactoryBuilder.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。