Hibernate version: 3.2.4
Hi there,
I'm new in hibernate and I have a problem on enabling 2nd level cache and query cache.
I'm not sure if this is the correct place to ask for this issue.
Basically, I have 2 servers that are using clustering (implemented with OSCache). For example, data A exists on my database table with value 1.
Then I did this:
Server 1: Query for A, get value 1
Server 2: Update A with value 2
Server 1: With the same session as before, query again for A, got value 1 when it should've been 2
After debugging the code and enabling hibernate+oscache logs, I found out:
1. Cache key for the entity I'm updating is flushed on Server 1 and 2 (flush notification is succesfully sent to Server 1)
2. However, when querying the second time, query cache doesn't check if this key is flushed, so it grabs the old result from the first query
3. Apparently, UpdateTimestampsCache that is added and updated in Server 2, doesn't get sent to Server 1, so Server 1's UpdateTimestampsCache is never updated. That's why the second query simply grabs the old result because it sees that the timestamps doesn't change.
Can somebody help me with this problem?
I have tried to debug this for the past 1 week and research on this issue, as well as read Hibernate manual but I found no solution.
For your reference, I'm using the latest OSCache 2.4.1 with OSCacheProvider from OScache.
Please let me know if you need more details from me..
Thanks a lot in advance!
|