ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neverov Dm <neverov...@nkmk.ru>
Subject Re: Cache
Date Tue, 25 Apr 2006 00:03:20 GMT
Nobody have such problem?


> Hi, I have question on cache.

> There is statement:

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

> 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"/>
>   </cacheModel>


> When I execute

>   public List getNormsAndNormatives(){
>     List result = new ArrayList(); 
>     result = normDao.getNormList(Norm.NORM_PID); //[1]
>     result.addAll(normDao.getNormList(Norm.NORMATIVS_PID));//[2]
>     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?


---------------------------------
-- 
Neverov                          mailto:neverov_dg@nkmk.ru





Mime
View raw message