I have a web application that has a bunch of entities that are read-only. For example:
Code:
<property name="entityCacheStrategies">
<props>
<prop key="com.me.myobject">read-only</prop>
...
The exception to this "read-onlyness" is a nightly batch update. But, when I try to run my batch update program, I get exceptions from the ReadOnlyCache (ehCache):
Code:
ERROR org.hibernate.cache.ReadOnlyCache - Application attempted to edit read only item:
java.lang.UnsupportedOperationException: Can't write to a readonly object
To try to fix this, I am now doing this during my batch update:
Code:
session.setCacheMode(CacheMode.IGNORE);
But, to no avail. I continue to receive the same exceptions from ReadOnlyCache. It seems like the CacheMode.IGNORE directive is being, uh, ignored.
I can work around this by setting the cache strategy to read-write, but that is not my preferred long-term solution.
I noticed an issue in jira (HHH-2661) that seems to be related, but I can't tell if it's been confirmed, denied, etc. Anyone have any thoughts on this?
FYI, I'm using hibernate 3.2.5ga