ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Caching queryForMap statements
Date Tue, 12 Jun 2007 13:43:24 GMT
What happens is the List that creates the Map is cached, but not the Map itself.

If you check out the source from svn, replace the two files attached,
and then run the build - it might work. :-)

If it does work, let us know and I'll commit the changes for the next
release. If not...spend some time and make it work, then we'll commit
the changes for the next release.

Larry


On 6/12/07, St├ęphane Hanser <s.hanser@omegames.com> wrote:
>
>
>
>
> Hi all,
>
>
>
> When I profiled my web application, I figured that I was not able to cache
> queries that return a Map as result. However it is the part I really do need
> to optimize in order to speed up the application. Can you tell me if it is
> possible or if I take it the wrong way?
>
>
>
> Thanks in advance,
>
>
>
> S. Hanser
>
>
>
> In my Dao Class :
>
>
>
>     public Map getAntecedentsForAptitude(int id) {
>
>         Map map =
> getSqlMapClientTemplate().queryForMap("Aptitude.getAntecedentsForAptitude",
> new Integer(id), "aptitude", "niveau");
>
>         return map;
>
>     }
>
>
>
>
>
> In my xml file :
>
>
>
>
>
>     <resultMap id="AptitudeMap.map" class="java.util.HashMap">
>
>         <result property="aptitude" column="id_aptitude_necessaire"
> select="Aptitude.getOne"/>
>
>         <result property="niveau" column="niveau"/>
>
>     </resultMap>
>
>
>
>
>
>     <cacheModel id="AptitudeMap.cache" type="LRU">
>
>         <flushInterval hours="1"/>
>
>         <flushOnExecute statement="Aptitude.insertOne"/>
>
>         <flushOnExecute statement="Aptitude.updateOne"/>
>
>         <flushOnExecute statement="Aptitude.deleteOne"/>
>
>         <flushOnExecute statement="Aptidude.insertBonus"/>
>
>         <flushOnExecute statement="Aptitude.deleteBonus"/>
>
>         <property name="size" value="200" />
>
>     </cacheModel>
>
>
>
>
>
>     <select id="Aptitude.getAntecedentsForAptitude"
> resultMap="AptitudeMap.map" cacheModel="AptitudeMap.cache" >
>
>         SELECT id_aptitude_necessaire, niveau
>
>         FROM antecedents_aptitudes
>
>         WHERE id_aptitude_voulue = #value#
>
>     </select>

Mime
View raw message