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 as shown below.
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 ! I am using Spring 2.5 and target database is MySQL. The iBatis version is 2.3.3. I tried debugging iBatis code and what I observed that whenever the sql map file is parsed, it does not add execute listeners for that cache statement. I think it should be my error somewhere so please let me know where I am going wrong. -- Regards, Jatan -------------------------------------------------------------------- ---------------------------------- SQL MAP Content ---------------------------------- ---------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" " http://ibatis.apache.org/dtd/sql-map-2.dtd" > <sqlMap namespace="masters"> <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> <cacheModel type="LRU" id="categoryCache" readOnly="true" serialize="false"> <flushOnExecute statement="masters.insertCategory"/> <flushOnExecute statement="masters.updateCategory"/> <flushOnExecute statement="masters.deleteCategory"/> <property name="size" value="1000"/> </cacheModel> <select id="selectCategory" resultMap="categoryResult" parameterClass="java.util.Map" cacheModel="masters.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> </sqlMap>