| I have encountered the same issue using java 8, hibernate 5.4.15 and EhCache 3.8.1 as a second level cache. I've tracked it down by activating the sun.io.serialization.extendedDebugInfo property, which gives the SerializationTrace.txt attached In short, here's what I found:
- The result query cache doesn't work with queries using named parameters on fields which are typed using a javax.persistence.Convert converter
- This is because the the resolved type which is stored inside org.hibernate.cache.spi.QueryKey is an instance of org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter which is not serializable.
- When the key is then stored inside EhCache, it throws the NotSerializableException
I'm reasonably certain that this is not a regression, but something that surfaced when moving to EhCache 3 (never had any issues with EhCache 2) What I do for now is to disable the result cache for these queries, but I have no real solutions. Any ideas? |