I thought I was always using deleteSpecificVehicle but in some cases the
code is calling a delete for the parent object (calls deleteVehicle). I
corrected the cacheModel to include a flush on delete of the parent
object and now it works as expected:
<cacheModel id="SpecificVehicleCache" implementation="LRU"
readOnly="false" serialize="true">
<flushInterval hours="1" />
<flushOnExecute statement="updateSpecificVehicle" />
<flushOnExecute statement="insertSpecificVehicle" />
<flushOnExecute statement="deleteSpecificVehicle" />
<flushOnExecute statement="Vehicle.updateVehicle" />
<flushOnExecute statement="Vehicle.deleteVehicle" />
</cacheModel>
Thank you very much,
Lazaro Pi
________________________________
From: Milivoj Milani [mailto:[EMAIL PROTECTED]
Sent: Monday, October 27, 2008 4:39 AM
To: [email protected]
Subject: RE: cache is not flush after delete
Did you delete the record using your application (ie. Using
deleteSpecificVehicle) or through some other database client tool?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2008 10:07 PM
To: [email protected]
Subject: cache is not flush after delete
Hi All,
I am using ibatis.net DataMapper (recent build of 1.6.1 source) and have
many mapping files where I use LRU cacheModel with no issues.
There is one, however, where the object is not flushed when the record
is deleted from the Database. If I try to load the object after is
deleted I get back the old record (which should have been flushed). I
have tried very hard to find any fault in the mapping but have not
succeeded so far.
An extract from my mapping:
---------------------------------------------
<cacheModel id="SpecificVehicleCache" implementation="LRU"
readOnly="false" serialize="true">
<flushInterval hours="1" />
<flushOnExecute statement="updateSpecificVehicle" />
<flushOnExecute statement="insertSpecificVehicle" />
<flushOnExecute statement="deleteSpecificVehicle" />
</cacheModel>
....
<procedure id="getSpecificVehicleById" resultClass="SpecificVehicle"
resultMap="SpecificVehicle"
parameterMap="IdParameterMap" cacheModel="SpecificVehicleCache" >
<![CDATA[IRM_spSpecificVehicleGetById]]>
</procedure>
<procedure id="deleteSpecificVehicle"
parameterMap="SpecificVehicleIdAndCallerParameterMap">
<![CDATA[IRM_spSpecificVehicleDelete]]>
</procedure>
---------------------------------------------
Any ideas why this might be happening?
Thanks in advance,
Lazaro Pi