Can you try changing your cache model definition to include and try it again?

<cacheModel id="selectEmpNameCache" readOnly="false" type="LRU">

My guess is that between the first fetch and the second, the cached
data is altered, and then the altered version is fetched again.

Larry


On 3/14/07, Meindert <[EMAIL PROTECTED]> wrote:




Hi there,



My cache is returning the wrong ID, for instance the statement

Select ID from X where ID=3 is returning not 3!



Here are the code sniplets I have that are producing the wrong data (after
the cache has been populated)



Requesting the employee with diary.getDiaryEmpId()=3

EmpName empName = (EmpName) queryForObject("selectEmpName",
diary.getDiaryEmpId());



The SQL

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

    <flushInterval hours="12"/>

    <flushOnExecute statement="updateEmployee"/>

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

</cacheModel>

  <select id="selectEmpName" parameterClass="int" resultClass="EmpName"
cacheModel="selectEmpNameCache">

    SELECT EmplMain.EmpId, CompanyId, EmplName, Surname, NickName, Code,
Email, Telephone1, Telephone2

       FROM EmplMain

       JOIN EmplProfile ON EmplProfile.EmpId = EmplMain.EmpId

       WHERE  EmplMain.EmpId=#value# AND EmplMain.IsActiveEmployee=1

  </select>



Results in fetching Employee out of cache

DEBUG [http-8084-Processor22] - Cache 'Employee.selectEmpNameCache':
retrieved object '[EMAIL PROTECTED]'



The resulting object has as Empid 1 and not 3!

All other field values are correct.





MEINDERT HOVING




Reply via email to