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>

Reply via email to