开发者

ibatis - where to place the <cacheModel> tag?

开发者 https://www.devze.com 2023-01-07 19:25 出处:网络
I have the map config file like this <sqlMap ..............> <alias> <typeAlias ......../>

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>....</parameterMa开发者_JS百科p>
    </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?


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


Before you use it in the select statement. Order does matter here. Otherwise sql map parser wouldn't be able to validate your sql map.

0

精彩评论

暂无评论...
验证码 换一张
取 消