This was originally reported to as a [bug|https://github.com/EsotericSoftware/kryo/issues/934] to my project, but I think that this is something that has to be resolved in Hibernate itself.
{{CacheKeyImplementation}} implements Serializable, but cache keys for some types have fields that are not serializable. See the following stacktrace:
{noformat}Caused by: org.hibernate.cache.CacheException: com.esotericsoftware.kryo.KryoException: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient volatile boolean java.lang.reflect.Executable.hasRealParameterData accessible: module java.base does not "opens java.lang.reflect" to unnamed module @2c13da15 Serialization trace: getterMethod (org.hibernate.property.access.spi.GetterFieldImpl) getters (org.hibernate.tuple.component.PojoComponentTuplizer) componentTuplizer (org.hibernate.type.EmbeddedComponentType) type (org.hibernate.cache.internal.CacheKeyImplementation) at org.redisson.hibernate.RedissonStorage.evictData(RedissonStorage.java:183) at org.hibernate.cache.spi.support.StorageAccess.removeFromCache(StorageAccess.java:35) at org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.remove(AbstractCachedDomainDataAccess.java:91) at org.hibernate.action.internal.CollectionAction.evict(CollectionAction.java:140) at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:52) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604) at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407) ... 4 more{noformat}
Cache keys for {{org.hibernate.type.EmbeddedComponentType}} contain a reference to {{java.lang.reflect.Field}} via {{org.hibernate.tuple.component.PojoComponentTuplizer}}.
Classes in {{java.lang.reflect}} are not serializable.
This issue has been resolved in Hibernate 6 where cache keys no longer reference the type itself, but the disassembled state of the type.
Does it make sense to backport the changes from to cache keys from Hibernate 6 to 5? |
|