Hibernate Query Cache
Hibernate provides sophisticated caching mechanisms to improve the performance. Apart from
First-level, Second-Level and query cache, Hibernate can be configured to make use of some open source cache solutions like EHCache or JBoss Cache etc.
If your Hibernate query yields huge but similar results every time it is executed, it is a good idea to cache the results in hibernate to improve the performance. This could be achieved by first enable the hibernate query cache in the hibernate configuration
in properties file
hibernate.cache.use_query_cache true
or xml configuration file like
<property name="hibernate.cache.use_query_cache">true</property>
and while executing the query specify the cacheability like this
sess.createQuery("from.......")
.setCacheable(true)
.list();
1 Comment »
Leave a comment
-
Archives
- October 2009 (2)
- September 2009 (3)
- August 2009 (2)
- July 2009 (1)
- June 2009 (2)
- May 2009 (3)
- April 2009 (8)
- February 2009 (2)
- December 2008 (1)
- November 2008 (3)
- October 2008 (1)
- January 2008 (8)
-
Categories
-
RSS
Entries RSS
Comments RSS

Have a look at Hibernate Cache blog
http://acupof.blogspot.com/2008/01/background-hibernate-comes-with-three.html