Examples of SqlSessionFactory


Examples of org.apache.ibatis.session.SqlSessionFactory

            }
        }
    }

    private void doInsertList(Exchange exchange) throws Exception {
        SqlSessionFactory client = endpoint.getSqlSessionFactory();
        SqlSession session = client.openSession();
        try {
            Object result;
            Object in = exchange.getIn().getBody();
            if (in != null) {
                // just pass in the body as Object and allow MyBatis to iterate using its own foreach statement
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

            }
        }
    }

    private void doUpdate(Exchange exchange) throws Exception {
        SqlSessionFactory client = endpoint.getSqlSessionFactory();
        SqlSession session = client.openSession();
        try {
            Object result;
            Object in = exchange.getIn().getBody();
            if (in != null) {
                // lets handle arrays or collections of objects
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

            }
        }
    }

    private void doDelete(Exchange exchange) throws Exception {
        SqlSessionFactory client = endpoint.getSqlSessionFactory();
        SqlSession session = client.openSession();
        try {
            Object result;
            Object in = exchange.getIn().getBody();
            if (in != null) {
                // lets handle arrays or collections of objects
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

  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

Examples of org.apache.ibatis.session.SqlSessionFactory

  @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

Examples of org.apache.ibatis.session.SqlSessionFactory

    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();
      if (conn != null) conn.close();
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

  @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);
    runner.setLogWriter(null);
    runner.setErrorLogWriter(null);
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

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);
            mapper.getOrder1(parameter);
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

    @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);
            mapper.getOrder2(parameter);
View Full Code Here

Examples of org.apache.ibatis.session.SqlSessionFactory

  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);
      Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/null_associations/create-schema-mysql.sql");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.