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 669663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:10:32+00:00 2026-05-14T00:10:32+00:00

When using Hibernate 2nd level cache and query cache and not specifying anything inside

  • 0

When using Hibernate 2nd level cache and query cache and not specifying anything inside ehcache.xml, what is the default caching time?

  • 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-14T00:10:33+00:00Added an answer on May 14, 2026 at 12:10 am

    Taken from the documentation on Cache Configuration:

    The following attributes and elements are optional.
    
    timeToIdleSeconds:
    Sets the time to idle for an element before it expires.
    i.e. The maximum amount of time between accesses before an element expires
    Is only used if the element is not eternal.
    Optional attribute. A value of 0 means that an Element can idle for infinity.
    The default value is 0.
    
    timeToLiveSeconds:
    Sets the time to live for an element before it expires.
    i.e. The maximum time between creation time and when an element expires.
    Is only used if the element is not eternal.
    Optional attribute. A value of 0 means that and Element can live for infinity.
    The default value is 0.
    

    Note that EHCache uses a timeToLive, not an expire time and the default is 0 if not specified.


    Update: While the above about defaults when configuring a cache is true, it appears that these defaults don’t apply if you don’t provide any ehcache.xml. So I dug a bit further and I think that EHCache may actually always use a defaultCache in that case – including for the StandardQueryCache – and this defaultCache has a timeToLive of 2 minutes:

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

    I can’t confirm this right now but this is what I would do:

    • first, activate logging on EHCache, EHCache logs a warning when the defaultCache is used:

    While the defaultCache is a great convenience, it is preferable for each Cache to be configured individually. For this reason a log warning level message is issued each time a cache is created based on the defaultCache values.

    • second, provide a ehcache.xml (and configure a cache for the StandardQueryCache).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want to prevent a component from being rendered,… May 14, 2026 at 3:54 am
  • Editorial Team
    Editorial Team added an answer On at least one occasion I've had files appear that… May 14, 2026 at 3:54 am
  • Editorial Team
    Editorial Team added an answer This is the browser's standard header and footer, and cannot… May 14, 2026 at 3:54 am

Related Questions

We have an application that uses Hibernate's 2nd level caching to avoid database hits.
When using Hibernate: Must I identify an id or composite id for each entity,
I'm using hibernate 3 and want to stop it from dumping all the startup
How can I get Hibernate (using JPA) to create MySQL InnoDB tables (instead of
AFAIK, Hibernate transforms all sql to prepared statement form before issuing it to the

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.