Package org.apache.ibatis.session

Examples of org.apache.ibatis.session.SqlSessionFactoryBuilder


    /** Creates a new instance of IBatisFactory */
    private IBatisFactory() {
        try {

          Reader reader = Resources.getResourceAsReader(resource);
          sqlMapper = new SqlSessionFactoryBuilder().build(reader);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
            // Fail fast.
            throw new RuntimeException("Something bad happened while building the SqlMapClient instance." + e, e);
View Full Code Here


            logger.debug( "DB url=" + url);
           

            String resource = "config/database.sql.xml";
            Reader reader = Resources.getResourceAsReader( resource);
            sqlMapper = new SqlSessionFactoryBuilder().build( reader, properties);
            reader.close();
           
//            SqlSession session = sqlMapper.openSession();
//            try {
//            Blog blog = (Blog) session.select(
View Full Code Here

    private SqlSessionFactory createSqlSessionFactory() throws IOException {
        ObjectHelper.notNull(configurationUri, "configurationUri", this);
        InputStream is = getCamelContext().getClassResolver().loadResourceAsStream(configurationUri);
        try {
            return new SqlSessionFactoryBuilder().build(is);
        } finally {
            IOHelper.close(is);
        }
    }
View Full Code Here

    final TransactionFactory transactionFactory = this.transactionFactoryClass.newInstance();

    final Environment env = new Environment(this.environment, transactionFactory, this.dataSource);
    configuration.setEnvironment(env);

    final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
    return builder.build(configuration);
  }
View Full Code Here

    private SqlSessionFactory createSqlSessionFactory() throws IOException {
        ObjectHelper.notNull(configurationUri, "configurationUri", this);
        InputStream is = getCamelContext().getClassResolver().loadResourceAsStream(configurationUri);
        try {
            return new SqlSessionFactoryBuilder().build(is);
        } finally {
            IOHelper.close(is);
        }
    }
View Full Code Here

    protected SqlSessionFactory createSqlSessionFactory() throws IOException {
        ObjectHelper.notNull(configurationUri, "configurationUri", this);
        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), configurationUri);
        try {
            return new SqlSessionFactoryBuilder().build(is);
        } finally {
            IOHelper.close(is);
        }
    }
View Full Code Here

    protected SqlSessionFactory createSqlSessionFactory() throws IOException {
        ObjectHelper.notNull(configurationUri, "configurationUri", this);
        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), configurationUri);
        try {
            return new SqlSessionFactoryBuilder().build(is);
        } finally {
            IOHelper.close(is);
        }
    }
View Full Code Here

  private DynamicSqlSource createDynamicSqlSource(SqlNode... contents) throws IOException, SQLException {
    createBlogDataSource();
    final String resource = "org/apache/ibatis/builder/MapperConfig.xml";
    final Reader reader = Resources.getResourceAsReader(resource);
    SqlSessionFactory sqlMapper = new SqlSessionFactoryBuilder().build(reader);
    Configuration configuration = sqlMapper.getConfiguration();
    MixedSqlNode sqlNode = mixedContents(contents);
    return new DynamicSqlSource(configuration, sqlNode);
  }
View Full Code Here

      runner.runScript(reader);
      conn.commit();
      reader.close();

      reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/encoding/EncodingConfig.xml");
      sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
      reader.close();

    } finally {
      // restore charset
      Resources.setCharset(charset);
View Full Code Here

            runner.runScript(reader);
            conn.commit();
            reader.close();

            reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/lazy_immutable/ibatisConfig.xml");
            factory = new SqlSessionFactoryBuilder().build(reader);
            reader.close();
        } finally {
            if (conn != null) {
                conn.close();
            }
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.