Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!