java - MyBatis - JUnit test shows 'out of memory' -


i doing junit test spring 3.1.1 , mybatis. made resultmap , put customized typehandler handling null value.

my map looks below :

<resultmap type="map" id="program">     <result property="serviceid"        column="id_svc"                 typehandler="stringhandler"/>     <result property="programid"        column="id_event"               typehandler="stringhandler"/>     <result property="programname"      column="nm_title"               typehandler="stringhandler"/>     <result property="directorname"     column="nm_director"            typehandler="stringhandler"/>     <result property="actorname"        column="nm_act"                 typehandler="stringhandler"/>     <result property="ratingcd"         column="cd_rating"              typehandler="stringhandler"/>     <result property="synopsis"         column="nm_synop"               typehandler="stringhandler"/>     <result property="img"              column="img"                    typehandler="stringhandler"/>     <result property="starttime"        column="dt_evnt_start"/>     <result property="endtime"          column="dt_evnt_end"/> </resultmap> 

there no doubt "stringhandler" works fine since other queries use same handler works without error.

but somehow when query got message "out of memory".

daotest.testcacheallprog testcacheallprog(com.test.dao.daotest) java.lang.outofmemoryerror: java heap space     @ java.util.hashmap.addentry(hashmap.java:753)     @ java.util.hashmap.put(hashmap.java:385)     @ org.apache.ibatis.type.unknowntypehandler.resolvetypehandler(unknowntypehandler.java:93)     @ org.apache.ibatis.type.unknowntypehandler.getnullableresult(unknowntypehandler.java:51)     @ org.apache.ibatis.type.basetypehandler.getresult(basetypehandler.java:55)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.getpropertymappingvalue(defaultresultsethandler.java:390)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.applypropertymappings(defaultresultsethandler.java:364)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.getrowvalue(defaultresultsethandler.java:338)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.handlerowvaluesforsimpleresultmap(defaultresultsethandler.java:291)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.handlerowvalues(defaultresultsethandler.java:266)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.handleresultset(defaultresultsethandler.java:236)     @ org.apache.ibatis.executor.resultset.defaultresultsethandler.handleresultsets(defaultresultsethandler.java:150)     @ org.apache.ibatis.executor.statement.preparedstatementhandler.query(preparedstatementhandler.java:60)     @ org.apache.ibatis.executor.statement.routingstatementhandler.query(routingstatementhandler.java:73)     @ org.apache.ibatis.executor.simpleexecutor.doquery(simpleexecutor.java:60)     @ org.apache.ibatis.executor.baseexecutor.queryfromdatabase(baseexecutor.java:267)     @ org.apache.ibatis.executor.baseexecutor.query(baseexecutor.java:137)     @ org.apache.ibatis.executor.cachingexecutor.query(cachingexecutor.java:96)     @ org.apache.ibatis.executor.cachingexecutor.query(cachingexecutor.java:77)     @ org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:108)     @ org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:102)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)     @ java.lang.reflect.method.invoke(method.java:597)     @ org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:358)     @ com.sun.proxy.$proxy13.selectlist(unknown source)     @ org.mybatis.spring.sqlsessiontemplate.selectlist(sqlsessiontemplate.java:198)     @ org.apache.ibatis.binding.mappermethod.executeformany(mappermethod.java:119)     @ org.apache.ibatis.binding.mappermethod.execute(mappermethod.java:63)     @ org.apache.ibatis.binding.mapperproxy.invoke(mapperproxy.java:52)     @ com.sun.proxy.$proxy20.getallprog(unknown source) 

i not know why happens. find clues messages? works same query , same resultmap in ibatis.(when ran query in sqldeveloper, took 23 seconds. know has problem @ works fine)

thanks helping me :d

p.s. sorry can not open queries. has security problems.

well looks mybatis trying turn entire result set hashmap. , there other hints resultset "rather large".

i'm not sure solution is, alternatives include:

  • increase heap size (though may putting off problem),
  • changing query there fewer results in resultset
  • (somehow) changing way application processing results doesn't need load them huge hashmap ...

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -