Search in sources :

Example 16 with AuthorMapper

use of org.apache.ibatis.domain.blog.mappers.AuthorMapper in project mybatis-3 by mybatis.

the class SqlSessionTest method shouldSelectAuthorsUsingMapperClassWithResultHandler.

@Test
public void shouldSelectAuthorsUsingMapperClassWithResultHandler() {
    SqlSession session = sqlMapper.openSession();
    try {
        DefaultResultHandler handler = new DefaultResultHandler();
        AuthorMapper mapper = session.getMapper(AuthorMapper.class);
        mapper.selectAllAuthors(handler);
        assertEquals(2, handler.getResultList().size());
    } finally {
        session.close();
    }
}
Also used : AuthorMapper(org.apache.ibatis.domain.blog.mappers.AuthorMapper) DefaultResultHandler(org.apache.ibatis.executor.result.DefaultResultHandler) BaseDataTest(org.apache.ibatis.BaseDataTest) Test(org.junit.Test)

Aggregations

BaseDataTest (org.apache.ibatis.BaseDataTest)16 AuthorMapper (org.apache.ibatis.domain.blog.mappers.AuthorMapper)16 Test (org.junit.Test)16 Author (org.apache.ibatis.domain.blog.Author)13 ImmutableAuthor (org.apache.ibatis.domain.blog.ImmutableAuthor)10 DefaultResultHandler (org.apache.ibatis.executor.result.DefaultResultHandler)3