Looks like this was broken by the change of IDs from Serializable to Object. The order of parameters to NaturalIdResolutions::handleEviction was changed. The call from DefaultEvictEventListener was also changed, but incorrectly. The first two parameters (should be id, object) are swapped (object, id). The compiler doesn’t catch this because they’re now both of type Object. This eventually results in the equals() method of any object already in the cache to be called with the ID of the object being evicted, rather than the object itself, and so findCachedNaturalIdById never finds anything, and removeResolution doesn’t remove the naturalId from the cache. I don’t know what the implications are of leaving a “dangling reference” like this in the cache (presumably discarded once the session is closed). |