ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neverov Dm <neverov...@nkmk.ru>
Subject Cache
Date Fri, 21 Apr 2006 00:17:53 GMT
Hi, I have question on cache.

There is statement:

<statement id="searchNorm" parameterClass="java.util.HashMap" resultMap="norm.NormWithValues"
    select t.lname,
    from sp_name t
    where t.pid = #pid#   
      <isNotNull property="normId" prepend="and">
            t.id = #normId#
    order by t.sname

CacheModel is:

  <cacheModel id="normCache" type="LRU" readOnly="true">
    <flushOnExecute statement="norm.insertNorm"/>
    <flushOnExecute statement="norm.updateNorm"/>
    <flushOnExecute statement="norm.deleteNorm"/>
    <property name="size" value="1000"/>

When I execute

  public List getNormsAndNormatives(){
    List result = new ArrayList(); 
    result = normDao.getNormList(Norm.NORM_PID); //[1]
    return result;

at first time all is right, at [1] I get 3 item in list with pid =
Norm.NORM_PID and at [2] 2 items with pid = Norm.NORMATIVS_PID.

But then I invoke it second time, I get 5 items in a result at [1]
with pid = Norm.NORM_PID and pid = Norm.NORMATIVS_PID, and also get 2
items at [2] with pid = Norm.NORMATIVS_PID.

Is it because caching in iBATIS does not use object identity? I also
try to use OSCache with the same result. Is there any solution for
this problem?


View raw message