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?
Cross-post with StackOverflow:
http://stackoverflow.com/q/7172846/277683