Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1029287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:31:18+00:00 2026-05-16T12:31:18+00:00

During performing some performance tuning in my application I have noticed, that hibernate query

  • 0

During performing some performance tuning in my application I have noticed, that hibernate query cache is never used.

I am quite sure I have it properly set up:

  • hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
  • hibernate.cache.use_query_cache=true
  • I use setCacheable(true) on queries I want to cache

I have set up a simple stress test, when I perform the same set of operations over and over by several threads. When I check hibernate statistics it turns out that query cache hitCount is zero!

What am I missing?

EDIT:
For all of you asking: I have set hibernate.generate_statistics = true

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:31:18+00:00Added an answer on May 16, 2026 at 12:31 pm

    I have set up a simple stress test, when I perform the same set of operations over and over by several threads. When I check hibernate statistics it turns out that query cache hitCount is zero!

    Well, while it is possible to get statistics about cache hits from statistics (if you enable statistics by setting the property hibernate.generate_statistics=true in your configuration), this is IMO not the best way to diagnose caching “issues”.

    My suggestion would be to activate the logging of 1. the DML statements that are executed and of 2. the cache activity. The relevant logging categories are:

    • org.hibernate.SQL Log all SQL DML statements as they are executed
    • org.hibernate.cache Log all second-level cache activity

    This is IMO more useful than statistics to fine tune the behavior during development.

    References

    • Hibernate Core Reference Documentation
      • 3.4.6. Hibernate statistics
      • 3.5 Logging
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Java application that will use some Hibernate (annotated by
I have got an application, that is getting data via XML-files. During the parsing-part
I have have a query that is performing poorly. One aspect of the query
How can I show tooltips while performing drag-n-drop. It seems that tooltip display during
I have CPU bound application that I wish to speedup using multiprocessing+threading instead of
I have a Java program performing some large analysis tasks, running through a loop
We have an ASP.Net application that provides administrators to work with and perform operations
I am developing an application using vb.net. For performing some tasks the application needs
I have added some files to svn repository during initial revisions. But now, those
I have a large function (I know, see below) that breaks proguard during its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.