Hi,
I really need help for my EhCache caching issue. I am using EhCache with Hibernate. I did whatever the document said to config the cache but can not get the cached records used. It still goes back to database everytime a query issued.
I turned on the debug info for EhCache, EhCacheProvider, ReadWriteCache, StandardQueryCache etc. I can tell the records have been cached but everytime to access it says "Cached item was locked". So no cached records returned. Sounds like this related to TimeStamp Cache.
In Christian and Gavin's Hibernate In Action page 292 says we should config the timestamp cache or we can turn the expiry off for timestamp cache.
Also I got a warn at the very beginning of my debug message:
WARN net.sf.hibernate.cache.EhCache - Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings.
Please help me where can I config there values? Very appreciate your help!
Hibernate version: 2.1.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
MSSQL
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
2004-09-17 17:43:05,728 [HttpProcessor[8080][4]] WARN net.sf.hibernate.cache.EhCache - Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings.
2004-09-17 17:43:05,748 [HttpProcessor[8080][4]] INFO net.sf.hibernate.cache.StandardQueryCache - starting query cache at region: net.sf.hibernate.cache.StandardQueryCache
2004-09-17 17:43:05,748 [HttpProcessor[8080][4]] WARN net.sf.hibernate.cache.EhCache - Could not find configuration for net.sf.hibernate.cache.StandardQueryCache. Configuring using the defaultCache settings.
2004-09-17 17:43:06,129 [HttpProcessor[8080][4]] INFO net.sf.hibernate.cache.StandardQueryCache - starting query cache at region: AllSearchRecordIDs
2004-09-17 17:43:06,129 [HttpProcessor[8080][4]] WARN net.sf.hibernate.cache.EhCache - Could not find configuration for AllSearchRecordIDs. Configuring using the defaultCache settings.
2004-09-17 17:43:06,139 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: AllSearchRecordIDs
2004-09-17 17:43:06,139 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortag0_.SID as x0_0_ from RM_COLOR_TAG colortag0_ order by name asc; parameters: ; named parameters: {}
2004-09-17 17:43:06,139 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select colortag0_.SID as x0_0_ from RM_COLOR_TAG colortag0_ order by name asc; parameters: ; named parameters: {} is null
2004-09-17 17:43:06,179 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:06,219 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: AllSearchRecordIDs
2004-09-17 17:43:06,249 [HttpProcessor[8080][4]] INFO net.sf.hibernate.cache.StandardQueryCache - starting query cache at region: RecordRegion
2004-09-17 17:43:06,249 [HttpProcessor[8080][4]] WARN net.sf.hibernate.cache.EhCache - Could not find configuration for RecordRegion. Configuring using the defaultCache settings.
2004-09-17 17:43:06,269 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: RecordRegion
2004-09-17 17:43:06,269 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortag0_.SID as SID, colortag0_.NAME as NAME, colortag0_.DESCRIPTION as DESCRIPT3_, colortag0_.FACILITY_MAP_CODE as FACILITY4_, colortag0_.STATUS as STATUS from RM_COLOR_TAG colortag0_ where (colortag0_.SID=? ); parameters: 2, ; named parameters: {}
2004-09-17 17:43:06,269 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select colortag0_.SID as SID, colortag0_.NAME as NAME, colortag0_.DESCRIPTION as DESCRIPT3_, colortag0_.FACILITY_MAP_CODE as FACILITY4_, colortag0_.STATUS as STATUS from RM_COLOR_TAG colortag0_ where (colortag0_.SID=? ); parameters: 2, ; named parameters: {} is null
2004-09-17 17:43:06,269 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:06,329 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Caching: 2
2004-09-17 17:43:06,329 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: 2
2004-09-17 17:43:06,329 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for 2 is null
2004-09-17 17:43:06,339 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Cached: 2
2004-09-17 17:43:06,339 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: RecordRegion
2004-09-17 17:43:06,369 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: net.sf.hibernate.cache.StandardQueryCache
2004-09-17 17:43:06,369 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortagfa0_.FACILITY_SID as x0_0_ from RM_COLOR_TAG_FACILITY colortagfa0_ where (colortagfa0_.RM_COLOR_TAG_SID=? ); parameters: 2, ; named parameters: {}
2004-09-17 17:43:06,379 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select colortagfa0_.FACILITY_SID as x0_0_ from RM_COLOR_TAG_FACILITY colortagfa0_ where (colortagfa0_.RM_COLOR_TAG_SID=? ); parameters: 2, ; named parameters: {} is null
2004-09-17 17:43:06,379 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:06,379 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: net.sf.hibernate.cache.StandardQueryCache
2004-09-17 17:43:06,379 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: RecordRegion
2004-09-17 17:43:06,379 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortag0_.SID as SID, colortag0_.NAME as NAME, colortag0_.DESCRIPTION as DESCRIPT3_, colortag0_.FACILITY_MAP_CODE as FACILITY4_, colortag0_.STATUS as STATUS from RM_COLOR_TAG colortag0_ where (colortag0_.SID=? ); parameters: 1, ; named parameters: {}
2004-09-17 17:43:06,389 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select colortag0_.SID as SID, colortag0_.NAME as NAME, colortag0_.DESCRIPTION as DESCRIPT3_, colortag0_.FACILITY_MAP_CODE as FACILITY4_, colortag0_.STATUS as STATUS from RM_COLOR_TAG colortag0_ where (colortag0_.SID=? ); parameters: 1, ; named parameters: {} is null
2004-09-17 17:43:06,389 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:06,389 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Caching: 1
2004-09-17 17:43:06,389 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: 1
2004-09-17 17:43:06,389 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for 1 is null
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Cached: 1
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: RecordRegion
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: net.sf.hibernate.cache.StandardQueryCache
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortagfa0_.FACILITY_SID as x0_0_ from RM_COLOR_TAG_FACILITY colortagfa0_ where (colortagfa0_.RM_COLOR_TAG_SID=? ); parameters: 1, ; named parameters: {}
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select colortagfa0_.FACILITY_SID as x0_0_ from RM_COLOR_TAG_FACILITY colortagfa0_ where (colortagfa0_.RM_COLOR_TAG_SID=? ); parameters: 1, ; named parameters: {} is null
2004-09-17 17:43:06,399 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:06,479 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: net.sf.hibernate.cache.StandardQueryCache
2004-09-17 17:43:43,273 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: AllSearchRecordIDs
2004-09-17 17:43:43,283 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select suspension0_.SID as x0_0_ from RM_SUSPENSION_TYPE suspension0_ order by name asc; parameters: ; named parameters: {}
2004-09-17 17:43:43,283 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select suspension0_.SID as x0_0_ from RM_SUSPENSION_TYPE suspension0_ order by name asc; parameters: ; named parameters: {} is null
2004-09-17 17:43:43,283 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:43,283 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: AllSearchRecordIDs
2004-09-17 17:43:43,293 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: RecordRegion
2004-09-17 17:43:43,293 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select suspension0_.SID as SID, suspension0_.NAME as NAME, suspension0_.DESCRIPTION as DESCRIPT3_, suspension0_.STATUS as STATUS from RM_SUSPENSION_TYPE suspension0_ where (suspension0_.SID=? ); parameters: 1, ; named parameters: {}
2004-09-17 17:43:43,293 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for sql: select suspension0_.SID as SID, suspension0_.NAME as NAME, suspension0_.DESCRIPTION as DESCRIPT3_, suspension0_.STATUS as STATUS from RM_SUSPENSION_TYPE suspension0_ where (suspension0_.SID=? ); parameters: 1, ; named parameters: {} is null
2004-09-17 17:43:43,293 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - query results were not found in cache
2004-09-17 17:43:43,303 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Caching: 1
2004-09-17 17:43:43,303 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: 1
2004-09-17 17:43:43,303 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for 1 is null
2004-09-17 17:43:43,303 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Cached: 1
2004-09-17 17:43:43,303 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - caching query results in region: RecordRegion
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: AllSearchRecordIDs
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortag0_.SID as x0_0_ from RM_COLOR_TAG colortag0_ order by name asc; parameters: ; named parameters: {}
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - Checking query spaces for up-to-dateness [[RM_COLOR_TAG]]
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: RM_COLOR_TAG
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for RM_COLOR_TAG is null
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - returning cached query results
2004-09-17 17:43:45,497 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - checking cached query results in region: RecordRegion
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: sql: select colortag0_.SID as SID, colortag0_.NAME as NAME, colortag0_.DESCRIPTION as DESCRIPT3_, colortag0_.FACILITY_MAP_CODE as FACILITY4_, colortag0_.STATUS as STATUS from RM_COLOR_TAG colortag0_ where (colortag0_.SID=? ); parameters: 2, ; named parameters: {}
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - Checking query spaces for up-to-dateness [[RM_COLOR_TAG]]
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: RM_COLOR_TAG
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - Element for RM_COLOR_TAG is null
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.StandardQueryCache - returning cached query results
2004-09-17 17:43:45,507 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Cache lookup: 2
2004-09-17 17:43:45,517 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: 2
2004-09-17 17:43:45,517 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Cached item was locked: 2
2004-09-17 17:43:45,527 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Caching: 2
2004-09-17 17:43:45,527 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.EhCache - key: 2
2004-09-17 17:43:45,527 [HttpProcessor[8080][4]] DEBUG net.sf.hibernate.cache.ReadWriteCache - Item was already cached: 2