Hi,
I am using iBatis for my database interaction. Lately I am trying to improve performance of some static data fetches by configuring caching. The chache got configured and worked properly however the problem is in flushing of cache data whenever any insert/update/delete happens to that data. I did following configuration for category table,
<cacheModel type="LRU" id="categoryCache" readOnly="true" serialize="false">
<flushOnExecute statement="insertCategory"/>
<flushOnExecute statement="updateCategory"/>
<flushOnExecute statement="deleteCategory"/>
<property name="size" value="1000"/>
</cacheModel>
<insert id="insertCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
insert into categories (code, description)
values(#code:VARCHAR#,#description:VARCHAR#)
</insert>
<update id="updateCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
update categories set description=#description:VARCHAR# where code=#code:VARCHAR#
</update>
<delete id="deleteCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
delete from categories where code=#code:VARCHAR#
</delete>
<select id="selectCategory" resultMap="categoryResult"
parameterClass="java.util.Map" cacheModel="categoryCache">
select * from categories where 1=1
<dynamic>
<isNotEmpty property="categoryVO.code">
and code like #categoryVO.code:VARCHAR#
</isNotEmpty>
<isNotEmpty property="categoryVO.description">
and description like
#categoryVO.description:VARCHAR#
</isNotEmpty>
<isNotEmpty property="orderBy">
order by $orderBy$
</isNotEmpty>
</dynamic>
</select>
Now the problem is that even if any of insertCategory / updateCategory / deleteCategory statement is executed, the cache does not get flushed. It maintains the data whatver was selected prior to insert / update / delete !
Please let me know where I am going wrong.