This is a pandora box, the cache keys are not meant to get serialized in this way. The 2LC implementation should extract an appropriate representation - and what that is, is not a general Hibernate issue.