Hi,
I have been trying to configure a particular group of queries using a cache region as specified in the documentation. Our deployment is Hibernate 2.1.8, JBossCache 1.1.1 and Spring. All mappings are generated using xdoclet annotations in each persistent object. Hibernate DB configuration is set using a properties file injected into the Spring session factory bean at startup-time. The same props file is used to set the 2nd level cache using the hibernate.cache.provider_class attribute.
Inside the DAO layer there are a number of queries that I'd like to optimize. To do so, I was planning to use a named cache region with particular rules, especially to set an expiration time different than the rest of the cache regions (generated by default by Hibernate with every persistent object).
I am confused about where and how to configure a cache region. The most convenient place for us is to use the same properties file used for setting the DB connection data mentioned before. I have been trying to use this property file to configure my cache region like this:
...
hibernate.cache.area1.timeToLiveSeconds=3600
hibernate.cache.area1.timeToIdleSeconds=1200
and I have used the setCacheRegion("area1") to all the queries that I wanted to be managed by "area1" cache region but it didn't work.
All I want is to be able to configure this region using some externalized parameters, preferably in the same place as all my other hibernate properties live (a properties file).
If you have any idea how to achieve this, please share it here.
Thank you,
florin
|