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

  • SEARCH
  • Home
  • 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 207557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:44:47+00:00 2026-05-11T17:44:47+00:00

I’ve set up ehcache on our Java application, which uses Spring and Hibernate. However,

  • 0

I’ve set up ehcache on our Java application, which uses Spring and Hibernate.
However, when I run Junit tests and print the stats, it seems there is nothing in cache:

OUTPUT OF CACHE MANAGER STATS ON EVERY CACHE:

COM.****.SERVICES.CLARITY.DOMAIN.ACTIONITEM.BYRESOURCEUNIQUENAME:
getCacheHits: 0
getCacheMisses: 0
getObjectCount: 0

COM.****.SERVICES.CLARITY.DOMAIN.ACTIONITEM:
getCacheHits: 0
getCacheMisses: 0
getObjectCount: 0

COM.****.SERVICES.CLARITY.DOMAIN.RESOURCE:
getCacheHits: 0
getCacheMisses: 0
getObjectCount: 0

CONTENT OF THE MAPPING FILE (ONLY PARTS, TOO BIG TO PASTE ALL):

<class name="ActionItem" table="CAL_ACTION_ITEMS" mutable="false" lazy="false" >
<cache region="com.****.services.clarity.domain.ActionItem" usage="read-only" include="all" />

[…]

<query name="byResourceUniqueName" cacheable="true" cache-region="com.****.services.clarity.domain.ActionItem.byResourceUniqueName" read-only="true">
    FROM ActionItem WHERE id IN (
        SELECT DISTINCT actionItemId FROM ActionItemAssignee as aia WHERE assigneeId IN (
            SELECT userId FROM Resource WHERE uniqueName = :uniqueName
        )
    )
    ORDER BY dueDate
</query>

CONTENT OF EHCACHE.XML:

<cache
    name="com.****.services.clarity.domain.ActionItem"
    maxElementsInMemory="2000" eternal="false" timeToIdleSeconds="0"
    timeToLiveSeconds="600" overflowToDisk="false" />

<cache
    name="com.****.services.clarity.domain.ActionItem.byResourceUniqueName"
    maxElementsInMemory="2000" eternal="false" timeToIdleSeconds="0"
    timeToLiveSeconds="60" overflowToDisk="false" />

<defaultCache maxElementsInMemory="200" eternal="false"
    timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
    memoryStoreEvictionPolicy="LRU" />

HIBERNATE CONFIG:

    <property name="hibernateProperties">
        <value>
            hibernate.format_sql=true
            hibernate.dialect=org.hibernate.dialect.OracleDialect
            hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider
            hibernate.cache.use_query_cache=true
            hibernate.show_sql=true
        </value>
    </property>
</bean>

Any ideas on how to populate the cache ?
Thanks.

  • 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-11T17:44:47+00:00Added an answer on May 11, 2026 at 5:44 pm

    Normally the items get populated to the cache by Hibernate automatically.

    One thing I noticed in your configuration is that you didn’t enable the statistics. Add the property

    hibernate.generate_statistics=true
    

    to your session factory’s configuration and see, if numbers occur in your output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 114k
  • Answers 114k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It should be stated that .NET reflection isn't revolutionary -… May 11, 2026 at 10:10 pm
  • Editorial Team
    Editorial Team added an answer Sure, no problem - performance will be almost the same… May 11, 2026 at 10:10 pm
  • Editorial Team
    Editorial Team added an answer If at first you have defined a read-only property in… May 11, 2026 at 10:10 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.