I’m having some struggle with the cache;

 

My servlet is showing checkboxes based on a byte value in a database field using a simple ByteToBit data object.

This is working fine when I’m not using cache, but when it is switched on the value for the object representing the byte becomes 0.

 

It works the first time (when the value get’s cached) but every subsequent call returns no value from the query.

I expect the data in column AllUsers in table Security to be represented by class SecurityItem.all

When debugging I see that the methode setAll in class SecurityItem is not called when the data is fetched from cache.

 

public void setAll(byte byteRights) {

    this.all = new ByteToBit(byteRights);

  }

 

 

<resultMap id="securityItem" class="SecurityItem">

..

    <result property="all" column="AllUsers"/>

  ..

  </resultMap>

 

 

<cacheModel id="getSecurityProperty" type="LRU">

    <flushInterval hours="24"/>

    <flushOnExecute statement="updateSecurity"/>

    <property name="cache-size" value="5"/>

 </cacheModel>

 

 <select id="getSecurityByPropertyId" resultMap="securityItem" parameterClass="int" cacheModel="getSecurityProperty">

    Select AllUsers

      from Security

      where PropertyId = #value#

 </select>

 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.4/57 - Release Date: 22/07/2005

Reply via email to