Я могу получить данные из кеш-памяти, но только для одного объекта, используя HibernateTemplate.load(Class entityClass, Serializable id)
,
[2012-03-06 04:34:18,755] [INFO] [com.uprr.app.rim.components.common.service.RIMSpringApplicationContext] [ApplicationContext is set and ready for use for XMF service clients....]
[2012-03-06 04:34:20,255] [WARN] [org.hibernate.mapping.RootClass] [composite-id class does not override equals(): com.uprr.app.rim.components.exinterface.domain.Track]
[2012-03-06 04:34:20,270] [WARN] [org.hibernate.mapping.RootClass] [composite-id class does not override hashCode(): com.uprr.app.rim.components.exinterface.domain.Track]
[2012-03-06 04:34:35,442] [DEBUG] [org.hibernate.cache.CacheFactory] [instantiating cache region: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO usage strategy: read-only]
[2012-03-06 04:34:35,442] [WARN] [org.hibernate.cache.CacheFactory] [read-only cache configured for mutable class: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO]
[2012-03-06 04:34:35,646] [DEBUG] [org.hibernate.cache.CacheFactory] [instantiating cache region: com.uprr.app.rim.components.masters.domain.CommPlaceDO usage strategy: read-only]
[2012-03-06 04:34:35,646] [WARN] [org.hibernate.cache.CacheFactory] [read-only cache configured for mutable class: com.uprr.app.rim.components.masters.domain.CommPlaceDO]
[2012-03-06 04:34:36,005] [INFO] [org.hibernate.cache.UpdateTimestampsCache] [starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache]
[2012-03-06 04:34:36,021] [INFO] [org.hibernate.cache.StandardQueryCache] [starting query cache at region: org.hibernate.cache.StandardQueryCache]
[2012-03-06 04:34:36,380] [DEBUG] [org.hibernate.SQL] [select commplacet0_.COM_PLAC_TYPE_ID as COM1_82_, commplacet0_.COM_PLAC_TYPE_CODE as COM2_82_, commplacet0_.COM_PLAC_TYPE_DESC as COM3_82_, commplacet0_.ACT_FLAG as ACT4_82_, commplacet0_.CRTN_USER_ID as CRTN5_82_, commplacet0_.CRTN_DT as CRTN6_82_, commplacet0_.LAST_UPTD_USER_ID as LAST7_82_, commplacet0_.LAST_UPTD_DT as LAST8_82_ from RIM_COM_PLAC_TYPE_MSTR commplacet0_ where commplacet0_.COM_PLAC_TYPE_ID=172 order by commplacet0_.COM_PLAC_TYPE_DESC]
[2012-03-06 04:34:37,052] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [**Caching**: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#172]
[2012-03-06 04:34:37,130] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [**Cache hit:** com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#172]
но когда я пытаюсь получить список объектов из кеш-памяти с помощью loadAll
(), getHibernateTemplate().find(strQuery)
, Query.list()
... все эти методы снова попадут в базу данных и снова попытаются кэшировать данные и показать предупреждение в логгере:
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [**item already cached:** com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#**180**]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#**169**]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#**166**]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#**139**]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#140]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#138]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#149]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#143]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#130]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#142]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#165]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#167]
[2012-03-08 06:56:10,050] [DEBUG] [org.hibernate.cache.ReadOnlyCache] [item already cached: com.uprr.app.rim.components.masters.domain.CommPlaceTypeDO#168]