I followed this example : https://code.google.com/p/mybatis/wiki/ResultHandlerExample This is my interface:
public interface CountryDirRdbMapper {
publi
I found the answer. Unfortunately MyBatis developers don't care about users at all. Shame on them. The truth is when we use custom result handlers we must use not interface but session.
MyResultHandler handler=new MyResultHandler();
session.select("select", handler);
After that the result must be taken from handler.
Figured it out from pieces of information
you need to get instance of SqlSession from your setup
sqlSession = sqlSessionFactory.openSession();
to use mapper with result handler, you need to make the mapper return void (important) and setup the result type for this mapper (important)
@Select("select * from user") void selectAllUser(ResultHandler handler)
get mapper from your sqlSession
UserMapper mapper = sqlSession.getMapper(User.class);
setup the session method with handler, the first parameter is the method name of the mapper you want to associate with your handler
sqlSession.select("selectAllUser", yourResultHandler);
start using your mapper
mapper.selectAllUser(yourResultHandler);
don't forget to release(close) session when done