• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding the Hibernate Query Cache  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!