BigMemory Max 4.3.5 | Product Documentation | BigMemory Max Integrations | Using BigMemory Max with Hibernate | FAQ
 
FAQ
If I use BigMemory Max with my application and with Hibernate for second-level caching, should I try to use the CacheManager created by Hibernate for my app's caches?
While you could share the resource file between the two CacheManagers, a clear separation between the two is recommended. Your application may have a different lifecycle than Hibernate, and in each case your CacheManager "Automatic Resource Control" settings might need to be different.
Should I use the provider in the Hibernate distribution or in BigMemory Max's Ehcache?
Since Hibernate 2.1, Hibernate has included an Ehcache CacheProvider. That provider is periodically synced up with the provider in the Ehcache Core distribution. New features are generally added in to the Ehcache Core provider and then the Hibernate one.
Does BigMemory Max support the transactional strategy?
Yes. It was introduced in Ehcache 2.1.
Why do certain caches sometimes get automatically cleared by Hibernate?
Whenever a Query.executeUpdate() is run, Hibernate invalidates affected cache regions (those corresponding to affected database tables) to ensure that no stale data is cached. This should also happen whenever stored procedures are executed.
For more information, see the Hibernate issue HHH-2224 at : https://hibernate.atlassian.net/browse/HHH-2224.
How are Hibernate entities keyed?
Hibernate identifies cached entities using an object id. This is normally the primary key of a database row.
Are compound keys supported?
Yes.
I am getting this error message: "An item was expired by the cache while it was locked." What is it?
Soft locks are implemented by replacing a value with a special type that marks the element as locked, thus indicating to other threads to treat it differently than a normal element. This is used in the Hibernate Read/Write strategy to force fall-through to the database during the two-phase commit. We cannot know exactly what should be returned by the cache while the commit is in process (but the database does). If a soft-locked element is evicted by the cache during the two-phase commit, then once the two-phase commit completes, the cache will fail to update (since the soft-locked element was evicted) and the cache entry will be reloaded from the database on the next read of that object. This is non-fatal, but could increase the database load slightly.
In summary the Hibernate messages are not problematic. The underlying cause is that the probabilistic evictor can theoretically evict recently loaded items. You can also use the deterministic evictor to avoid this problem. Specify the -Dnet.sf.ehcache.use.classic.lru=true system property to turn on classic LRU, which contains a deterministic evictor.

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release