Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding the Hibernate Query Cache

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
To use the query cache you must first enable it by setting the property hibernate.cache.use_query_cache=true.

Will this be responsible to cache the data extracted from the DataBase.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RaviNada Kiran wrote:Hello all,
To use the query cache you must first enable it by setting the property hibernate.cache.use_query_cache=true.

Will this be responsible to cache the data extracted from the DataBase.



You need to enable the query cache and define your query as cacheable. See the documentation. Note the important detail there that most queries do not benefit from caching.
 
Mansi Mishra
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RaviNada Kiran wrote:Hello all,
To use the query cache you must first enable it by setting the property hibernate.cache.use_query_cache=true.

Will this be responsible to cache the data extracted from the DataBase.



Just add .setCacheable(true) to the end of the query

Mansi
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks paul and Mishra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic