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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:47:27+00:00 2026-05-25T06:47:27+00:00

We use Ehcache as L2 cache for Hibernate in a cluster. Since we update

  • 0

We use Ehcache as L2 cache for Hibernate in a cluster. Since we update servers one by one to avoid downtime, at some point it is possible that in the cluster one server is running older version of code, and another the updated version.

I thought the issue was Ehcache, but I narrowed it down to Hibernate. Hibernate does not cache whole entities, but arrays of field values. So if you got entity with different schema replicated into your cache, Bad Things happen on load as the array is blindly copied.

I can’t stop this on Ehcache level. I thought of setting serialVersionUID on my entity classes, but that won’t work with those lower-level arrays.

How can I indicate to Hibernate that entity version has changed and the value from cache should NOT be loaded?

  • 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-25T06:47:28+00:00Added an answer on May 25, 2026 at 6:47 am

    I don’t think you can avoid temporary degradation of capacity in this case because what you have here is a system running servers with incompatible codebases.

    Even if you could asses the incompatibility of the entity format and it’s cached version and not to load it from cache, what you would end up with is that some machines would be reading from/writing to cache, and some would go straight to the database which will cause inconsistent data access, and so on and so forth. Basically, this approach is a can of worms.

    There is a better solution. The steps include:

    1. Disconnect a half of the cluster from the network. You can use switch’s or load balancer’s management or any other means available.
    2. Take down that half, upgrade it, bring it up.
    3. Connect it back.
    4. Disconnect the second.
    5. Repeat #2 and #3.

    What you get here is temporarily degradation of capacity while still keeping the system available to serve customer requests while upgrading. It can work nicely during off-peak hours. You may enhance it by routing new requests to the upgraded part of the cluster as it becomes increasingly available. There other variations but the idea is the same – divide and conquer.

    The only thing that is important that new and old cluster should not be talk to each other. You’ll need help of your operations but it’s certainly doable.

    Hope this helps.

    Slava Imeshev

    Cacheonix: Reliable Distributed Java Cache

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

Sidebar

Related Questions

Does Ehcache 2.1 now support the transactional cache concurrency strategy in Hibernate 3.3.2GA? That
Is it possible to use Ehcache Cache Server and have it be configured with
I found some instructions how to configure pure hibernate to use EHCache. But I
i specified the below properties in cfg file. <property name=hibernate.cache.use_second_level_cache>true</property> <property name=hibernate.cache.provider_class> net.sf.ehcache.hibernate.EhCacheProvider</property> In
I use Spring 3.0 and ehcache. I have added @Cacheable annotations to some methods
I'm using ehcache with hibernate and I'd like to use the blocking or SelfPopulating
I'm considering to use to implement a cache either JBoss Cache or Ehcache. After
My DAL is implemented with Hibernate and I want to use EHCache as its
I have a high traffic website and I use hibernate. I also use ehcache
I use EhCache with a memory cache loaded from a disk cache. When dumping

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.