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 508k
  • Answers 508k
  • 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 The problem is that in the OnFaultCompleted() you are calling… May 16, 2026 at 4:14 pm
  • Editorial Team
    Editorial Team added an answer Right, the first argument is the tag (to which you'll… May 16, 2026 at 4:14 pm
  • Editorial Team
    Editorial Team added an answer If you find a database structure easier to work with,… May 16, 2026 at 4:14 pm

Trending Tags

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

Top Members

Related Questions

We can speed up a hibernate app easyly with 2nd level cache using infinispan
Hi I've run into some problems with hibernate 2nd level cache. As cache provider
We have an application that uses Hibernate's 2nd level caching to avoid database hits.
Will the Hibernate caching(1st, 2nd, or Query) work when I use JdbcTemplate? I got
When you run a JPQL update or delete query, is Hibernate smart enough to
Using hibernate, how can I persist a class with a List<String> field? Consider the
am using hibernate merge method, to deal with detached instance from entity, and i
I am using Hibernate and got the exception ArrayIndexOutOfBoundsException. What are the possible causes?
I'm using Hibernate/JPA and have an @Entity object called Order, pointing at a MySQL
Can any one share some information about the sample application using hibernate for learning.

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.