caching - Hibernate 2nd level cache + Ehcache issue when trying to get data (List of object) from cache memory -


i able data cache memory 1 object using hibernatetemplate.load(class entityclass, serializable id),

[2012-03-06 04:34:18,755] [info] [com.uprr.app.rim.components.common.service.rimspringapplicationcontext] [applicationcontext set , ready use xmf service clients....] [2012-03-06 04:34:20,255] [warn] [org.hibernate.mapping.rootclass] [composite-id class 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 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 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 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 @ region: org.hibernate.cache.updatetimestampscache] [2012-03-06 04:34:36,021] [info] [org.hibernate.cache.standardquerycache] [starting query cache @ region: org.hibernate.cache.standardquerycache] [2012-03-06 04:34:36,380] [debug] [org.hibernate.sql] [select commplacet0_.com_plac_type_id com1_82_, commplacet0_.com_plac_type_code com2_82_, commplacet0_.com_plac_type_desc com3_82_, commplacet0_.act_flag act4_82_, commplacet0_.crtn_user_id crtn5_82_, commplacet0_.crtn_dt crtn6_82_, commplacet0_.last_uptd_user_id last7_82_, commplacet0_.last_uptd_dt last8_82_ rim_com_plac_type_mstr commplacet0_ commplacet0_.com_plac_type_id=172 order 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] 

but when trying list of object cache memory using loadall(), gethibernatetemplate().find(strquery), query.list()... these method hit database again , trying caching data again , show alert in logger :

[2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [**item cached:** com.uprr.app.rim.components.masters.domain.commplacetypedo#**180**] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#**169**] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#**166**] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#**139**] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#140] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#138] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#149] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#143] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#130] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#142] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#165] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#167] [2012-03-08 06:56:10,050] [debug] [org.hibernate.cache.readonlycache] [item cached: com.uprr.app.rim.components.masters.domain.commplacetypedo#168] 

i'm facing same problem when activating second level cache & trying cache criterias.

if don't set cacheable true,

update : found solution, problem came hibernate version. in hibernate 3.2. upgrading 3.6.9 solved problem :)

hope can !


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -