I'm using the EHCache as a second level cache, which is working fine when I store an object, re-loading it several times in different sessions (i.e. multiple requests) uses the cache and avoids the database hit. Which is great.
However, if I update the object, it forces the cache to be invalidated and reloads the complete object graph from the database. I wouldn't expect this behaviour as hibernate should know what has changed, and so should need to invalidate the second level cache object.
Am I missing something, is is possible to ensure that objects in second level are not evicted on update (i.e. I want to stop the object being re-loaded from the database as hibernate will know what has changed and could just update the second level cahce with the changes, rather than just invalidating.
Many thanks, Pete.
|