java - MyBatis - ResultHandler is not invoked -


i followed example : https://code.google.com/p/mybatis/wiki/resulthandlerexample interface:

public interface countrydirrdbmapper {     public static class countrydirbaseitemwithtext {         public countrydirbaseitem baseitem;     }     public list<countrydirbaseitem> select(resulthandler handler); } 

this xml mapper

  <resultmap id="readitemsrm" type="countrydirrdbmapper$countrydirbaseitemwithtext">         <association property="baseitem" javatype="countrydirbaseitem">             <id property="id" column="id"/>             <result property="comment" column="comment"/>         </association>     </resultmap> 

this code form dao:

sqlsession session = mybatisconnectionfactory.getsqlsessionfactory().opensession(true); list<countrydirbaseitem> list;   try{        countrydirrdbmapper mapper = session.getmapper(countrydirrdbmapper.class);        class myresulthandler implements resulthandler {            @override            public void handleresult(resultcontext context) {            system.out.println("#########################");            }        }      myresulthandler handler=new myresulthandler();       list= mapper.select(handler);  }     {    session.close(); } 

however result handler never invoked. @ example follow people have same problem. how make work? or result handler not supported in mybatis 3?

i found answer. unfortunately mybatis developers don't care users @ all. shame on them. truth when use custom result handlers must use not interface session.

myresulthandler handler=new myresulthandler(); session.select("select", handler); 

after result must taken handler.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -