ibatisibatis.net

ibatis - where to place the <cacheModel> tag?


I have the map config file like this

<sqlMap ..............>

    <alias>
      <typeAlias ......../>
    </alias>

    <statements>
      ....
      <sql>....</sql>
      <select cacheModel="cache-select-all">....</select>
      <update>...</update>
      <procedure>...</procedure>
      .....
    </statements>    

    <parameterMaps>
      <parameterMap>....</parameterMap>
    </parameterMaps>

    <cacheModel id="cache-select-all" type="LRU" readOnly="true" serialize="false">
      <flushInterval hours="24"/>
      <flushOnExecute statement="InsertIOs"/>
      <!--<property name="CacheSize" value="1000"/>-->
    </cacheModel>

  </sqlMap>

I am using ibatis (.net, if that matters) and i have one question: where to place the tags? is There a or because placing it like i did, in the statements seems not to work. What am i doing wrong?


Solution

  • You must reference the cacheModel you defined inside a statement tag as shown in the following link:

    http://ibatis.apache.org/docs/dotnet/datamapper/ch03s08.html