Package org.apache.ibatis.session

Examples of org.apache.ibatis.session.SqlSession.select()


          Child child = (Child)context.getResultObject();
          children.add(child);
        }
        };
        MyResultHandler myResultHandler = new MyResultHandler();
        sqlSession.select("org.apache.ibatis.submitted.deferload_common_property.ChildMapper.selectAll", myResultHandler);
        for (Child child: myResultHandler.children) {
        assertNotNull(child.getFather());
        }
      } finally {
        sqlSession.close();
View Full Code Here


        public void handleResult(ResultContext context) {
          Child child = (Child)context.getResultObject();
          assertNotNull(child.getFather());
        }
        };
        sqlSession.select("org.apache.ibatis.submitted.deferload_common_property.ChildMapper.selectAll", new MyResultHandler());
      } finally {
        sqlSession.close();
      }
    }
    @Test
View Full Code Here

          Child child = (Child)context.getResultObject();
          children.add(child);
        }
        };
        MyResultHandler myResultHandler = new MyResultHandler();
        sqlSession.select("org.apache.ibatis.submitted.deferload_common_property.ChildMapper.selectAll", myResultHandler);
        for (Child child: myResultHandler.children) {
        assertNotNull(child.getFather());
        }
      } finally {
        sqlSession.close();
View Full Code Here

        public void handleResult(ResultContext context) {
          Child child = (Child)context.getResultObject();
          assertNotNull(child.getFather());
        }
        };
        sqlSession.select("org.apache.ibatis.submitted.deferload_common_property.ChildMapper.selectAll", new MyResultHandler());
      } finally {
        sqlSession.close();
      }
    }
}
View Full Code Here

  @Test
  public void shouldExecuteMultipleBoundSelectOfBlogsByIdInWithProvidedResultHandlerBetweenSessions() {
    SqlSession session = sqlSessionFactory.openSession();
    try {
      final DefaultResultHandler handler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", handler);

      //new session
      session.close();
      session = sqlSessionFactory.openSession();
View Full Code Here

      //new session
      session.close();
      session = sqlSessionFactory.openSession();

      final DefaultResultHandler moreHandler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", moreHandler);
     
      assertEquals(2, handler.getResultList().size());
      assertEquals(2, moreHandler.getResultList().size());

    } finally {
View Full Code Here

  @Test
  public void shouldExecuteMultipleBoundSelectOfBlogsByIdInWithProvidedResultHandlerInSameSession() {
    SqlSession session = sqlSessionFactory.openSession();
    try {
      final DefaultResultHandler handler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", handler);

      final DefaultResultHandler moreHandler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", moreHandler);

      assertEquals(2, handler.getResultList().size());
View Full Code Here

    try {
      final DefaultResultHandler handler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", handler);

      final DefaultResultHandler moreHandler = new DefaultResultHandler();
      session.select("selectBlogsAsMapById", moreHandler);

      assertEquals(2, handler.getResultList().size());
      assertEquals(2, moreHandler.getResultList().size());

    } finally {
View Full Code Here

    SqlSession sqlSession = sqlSessionFactory.openSession();
    final SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
    Date targetMonth = fmt.parse("2014-01-01");
    final List<Account> accounts = new ArrayList<Account>();
    try {
      sqlSession.select("collectPageByBirthMonth", targetMonth, new RowBounds(1, 2), new ResultHandler() {
        @Override
        public void handleResult(ResultContext context) {
          Account account = (Account) context.getResultObject();
          accounts.add(account);
        }
View Full Code Here

    SqlSession sqlSession = sqlSessionFactory.openSession();
    final SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
    final List<Account> accounts = new ArrayList<Account>();
    try {
      Date targetMonth = fmt.parse("2014-01-01");
      sqlSession.select("collectPageByBirthMonth", targetMonth, new ResultHandler() {
        @Override
        public void handleResult(ResultContext context) {
          Account account = (Account) context.getResultObject();
          accounts.add(account);
          if (accounts.size() > 1)
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.