Announcement Announcement Module
No announcement yet.
Spring 2.5.6 broke ibatis caching Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 2.5.6 broke ibatis caching

    I am hoping someone else has already solved this problem. The project I am on has been using spring and ibatis for some time now. After upgrading from spring 2.0.x to 2.5.6 for spring, the ibatis cache stopped working.

    We looked as at the simplest tables in our code base where there were no joines being done, just straight get, insert, update commands. Caching is enabled, but the cache is no longer being used. I know the ibatis code is correct as it worked prior to the 2.5.6 upgrade.

    Is there some new configuration changes that need to be made to get it to work? We have a release coming up soon and need to find a resolution. Thanks for your help!

    Here si the cacheModel definition
    <cacheModel id="locationType_cache" type="LRU" readOnly="false" serialize="false">
    <flushInterval hours="24"/>
    <flushOnExecute statement="LocationType.insertLocationType-MSSQLServer"/>
    <flushOnExecute statement="LocationType.insertLocationType-Oracle"/>
    <flushOnExecute statement="LocationType.removeLocationType"/>
    <flushOnExecute statement="LocationType.updateLocationType"/>
    <property name="size" value="10"/>


    Here is the ibatis sql being run
    <select id="getAllLocationTypes" cacheModel="locationType_cache" resultMap="location-type-map">
    <!-- include refid="select_location_type_fragment"/ -->
    SELECT location_type_id,
    FROM location_type
    ORDER BY location_type_nm

    I wrote a simple JUnit test to verify that it was not working.
    I injected the ibatis dao into the test class, I also injected the dastsource, so that I could use the spring SimpleJdbcInsert to verify that the caching was broken. I retrieved the list of objects using the ibatis dao, the length was 3, using spring SimpleJdbcInsert, I bypassed ibatis and inserted another object. Then using the ibatis dao, I retrieved the list again. If caching was working the list should still be at 3, however it came back with 4.

    We validated the caching was no longer working through several other manual ways too.

    Any help on how to get the caching working again would be greatly appreciated.


  • #2
    Cache model changed

    I must print a retraction. After much more review, I discovered that the cache model was in fact changed in addition to upgrading to 2.5.6. The parameters readOnly and serialize were added, and the values that were selected for those are what caused the caching to fail.