Package org.apache.ibatis.session

Examples of org.apache.ibatis.session.SqlSessionFactoryBuilder


  @Test
  public void testIncludes() throws Exception {
    String resource = "org/apache/ibatis/submitted/includes/MapperConfig.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
    SqlSessionFactory sqlMapper = builder.build(reader);
    assertNotNull(sqlMapper);
  }
View Full Code Here


  }

  private static void setupSqlSessionFactory() throws IOException {
    String resource = "org/apache/ibatis/submitted/complex_property/db/Configuration.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
  }
View Full Code Here

  public void shouldParseMapWithIntegerJdbcType() throws Exception {
    DataSource ds = BaseDataTest.createJPetstoreDataSource();
    Connection conn = ds.getConnection();
    String resource = "org/apache/ibatis/submitted/integer_enum/MapperConfig.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
    SqlSessionFactory sqlMapper = builder.build(reader);
    SqlSession session = sqlMapper.openSession(conn);
    try {
      assertNotNull(session);
    } finally {
      if (session != null) session.close();
View Full Code Here

  @Test
  public void initDatabase() throws IOException {
    String resource = "org/apache/ibatis/submitted/map_class_name_conflict/mapper/ibatisConfig.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    new SqlSessionFactoryBuilder().build(reader);
  }
View Full Code Here

  @Test
  public void testGetMessageForEmptyDatabase() throws Exception {
    final String resource = "org/apache/ibatis/submitted/initialized_collection_property/ibatis-config.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader);

    SqlSession session = factory.openSession();

    Connection conn = session.getConnection();
    ScriptRunner runner = new ScriptRunner(conn);
View Full Code Here

    Environment environment = new Environment("test", new JdbcTransactionFactory(), new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:annots", null));
    configuration.setEnvironment(environment);
   
    configuration.addMapper(SubstitutionInAnnotsMapper.class);
   
    sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
  }
View Full Code Here

public class RefCursorTest {
    @SuppressWarnings("unchecked")
    @Test
    public void testRefCursor1() throws IOException {
        Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/refcursor/MapperConfig.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        try {
            OrdersMapper mapper = sqlSession.getMapper(OrdersMapper.class);
            Map<String, Object> parameter = new HashMap<String, Object>();
            parameter.put("orderId", 1);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testRefCursor2() throws IOException {
        Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/refcursor/MapperConfig.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        try {
            OrdersMapper mapper = sqlSession.getMapper(OrdersMapper.class);
            Map<String, Object> parameter = new HashMap<String, Object>();
            parameter.put("orderId", 1);
View Full Code Here

  private static synchronized void init() {
    if (sqlSessionFactory == null)
      try {
        final String resource = "org/apache/ibatis/submitted/primitive_result_type/ibatis.xml";
        Reader reader = Resources.getResourceAsReader(resource);
        sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
  }
View Full Code Here

  private static SqlSession session;

  @BeforeClass
  public static void setUpBeforeClass() {
    try {
      final SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(SQL_MAP_CONFIG));
      session = factory.openSession();
      Connection conn = session.getConnection();
      ScriptRunner runner = new ScriptRunner(conn);
      runner.setLogWriter(null);
      runner.setErrorLogWriter(null);
View Full Code Here

TOP

Related Classes of org.apache.ibatis.session.SqlSessionFactoryBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.