ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jatan Porecha <porecha...@gmail.com>
Subject Cache does not get flushed on the specified statement execution.
Date Thu, 19 Mar 2009 20:17:54 GMT

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

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.

---------------------------------- 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"
        insert into categories (code, description)

    <update id="updateCategory"
        update categories set description=#description:VARCHAR# where

    <delete id="deleteCategory"
        delete from categories where code=#code:VARCHAR#

    <cacheModel  type="LRU" id="categoryCache"  readOnly="true"
        <flushOnExecute statement="masters.insertCategory"/>
        <flushOnExecute statement="masters.updateCategory"/>
        <flushOnExecute statement="masters.deleteCategory"/>
        <property name="size" value="1000"/>

    <select id="selectCategory" resultMap="categoryResult"
        parameterClass="java.util.Map" cacheModel="masters.categoryCache">
        select * from categories where 1=1
            <isNotEmpty property="categoryVO.code">
                and code like #categoryVO.code:VARCHAR#
            <isNotEmpty property="categoryVO.description">
                and description like
            <isNotEmpty property="orderBy">
                order by $orderBy$



View raw message