If you switch your second level cache to
org.hibernate.cache.HashtableCacheProvider do you still get the same
error?
I'm having a hard time seeing how hibernate-memcached is causing this.
I don't even see hibernate-memcached in the stack trace for example.
Let's see if we can get to the bottom of this. I've honestly never
persisted a map or used the @MapKey annotation at all.
Can you try this again with the HashtableCacheProvider if you haven't already?
Do you already have a "Type" annotation setup somewhere that defines
the mapping for that enum you're using? JPA/Hibernate won't handle
Enums by default without mapping out the type.
Maybe pull down the hibernate-memcached source and debug through it to
see what gets cached.
It's really weird because hibernate-memcached doesn't look at what's
being cached at all. It just takes what hibernate gives it and puts in
memcached.
Though just now I'm realizing I did see some weirdness with memcached
wherein you put an int into the cache and get back a string. That
definitely isn't the case here though as you're seeing a class/string
ClassCastException. Very weird.