-
1. Re: performance and caching in the hibernate mappings
camedinag Nov 23, 2005 2:33 PM (in response to icyjamie)Hello,
Can you give an example of what must be changed in hibernate.cfg.xml for caching
Thanks -
2. Re: performance and caching in the hibernate mappings
icyjamie Nov 24, 2005 1:59 AM (in response to icyjamie)in hibernate.properties, I added:
hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true
in every hbm file, look up collection definitions and add<cache usage="nonstrict-read-write"/> e.g. <list name="nodes" cascade="all"> <cache usage="nonstrict-read-write"/>
-
3. Re: performance and caching in the hibernate mappings
stembol Nov 24, 2005 6:05 AM (in response to icyjamie)A few remarks:
hibernate.cache.use_second_level_cache is is enabled by default for classes which specify a mapping.
hibernate.cache.use_query_cache enables the query cache (individual queries still have to be set cachable). Do you use cachable queries?
The nonstrict-read-write strategy you use is probably not the best one for every collection. The other strategies are: read only, read/write, and transactional. -
4. Re: performance and caching in the hibernate mappings
icyjamie Nov 25, 2005 1:33 AM (in response to icyjamie)It was just a quick fix, just to see how things would improve. Of course, other settings must be examined. I guess use_query_cache is not needed, because from what I've seen from sourcecode, queries are not set to be cached (and maybe would be impractical in this situation).
I've included the use_second_level_cache to turn it on and off, for testing purposes. So indeed, the default is "on".