Hello,
I noticed that the method isCacheInvalidationRequired() in AbstractEntityPersister only checks for versioning as a way of "forcing" potentially dangerous cache updates.
I have simple immutable POJOs. Therefore no versioning (as that would defeat the purpose of having a read-only cache since version updates are indeed
UPDATES), no dynamic updates, no formula properties; just run of the mill POJOs however some being spanned across several tables (using a subclass per hierarchy mapping).
If the objects being stored are in need immutable (mutable="false") why won't the persister allow the second-level cache update (which in my case is Ehcache)?
I really don't feel like adding my own persister for every entity which is subject to this behavior. Does this code change sound completely crazy or potentially dangerous?
Code:
public boolean isCacheInvalidationRequired() {
return hasFormulaProperties() ||
((!isVersioned() || !isMutable()) && ( entityMetamodel.isDynamicUpdate() || getTableSpan() > 1 ) );
}
Thanks for any help.