Hi,
I enabled JCS caching for a couple of classes in the hibernate. When I start the server, I'm getting log statements saying Hibernate's caching class and also the logging statements by JCS, correctly showing the name of the classes for I've enabled the caching.
However, when I make a call to load the object using session.load(), hibernate is printing the SQL query that is used for fetching the object from the database.
Also, when I run hibernate in debug mode, the log statements shows as follows:
Code:
15:45:36,671 DEBUG [lru.LRUMemoryCache (get:224)] getting item from cache com.maco.common.Member for key 202
15:45:36,671 DEBUG [lru.LRUMemoryCache (get:234)] com.maco.common.Member: LRUMemoryCache hit for 202
15:45:36,671 DEBUG [lru.LRUMemoryCache (verifyCache:610)] verifycache[com.maco.common.Member]: mapContains 1 elements, linked list contains 1 elements
15:45:36,671 DEBUG [lru.LRUMemoryCache (verifyCache:612)] verifycache: checking linked list by key
15:45:36,671 DEBUG [lru.LRUMemoryCache (verifyCache:641)] verifycache: checking linked list by value
15:45:36,671 DEBUG [lru.LRUMemoryCache (verifyCache:651)] verifycache: checking via keysets!
15:45:36,671 DEBUG [control.CompositeCache (get:498)] com.maco.common.Member - Memory cache hit
15:45:36,687 DEBUG [impl.SessionImpl (doLoad:2028)] object not resolved in any cache [com.maco.common.Member#202]
15:45:36,687 DEBUG [persister.EntityPersister (load:354)] Materializing entity: [com.maco.common.Member#202]
...
After this the log statements show that hibernate is making call to the database and fetching the entity.
From the log statements it looks like cache is hit for the corresponding entity but still hibernate makes a call to database for fetching the entity. Can you please explain me what I need to configure so that Hibernate uses the JCS cache?
Regards,
Balakrishnan.
P.S: My current configuration file contains the following single line for JCS caching(with separate cache.ccf file for JCS configuration).
<jcs-cache class="com.maco.common.Member" usage="nonstrict-read-write" />