CacheHelper#fromSharedCache no longer needs to return a Serializable object

This commit is contained in:
Sanne Grinovero 2022-11-15 18:35:27 +00:00 committed by Sanne Grinovero
parent 3fabde0cd9
commit 1eeccd32eb
1 changed files with 3 additions and 5 deletions

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.engine.internal;
import java.io.Serializable;
import org.hibernate.cache.spi.access.CachedDomainDataAccess;
import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
@ -21,15 +19,15 @@ public final class CacheHelper {
private CacheHelper() {
}
public static Serializable fromSharedCache(
public static Object fromSharedCache(
SharedSessionContractImplementor session,
Object cacheKey,
CachedDomainDataAccess cacheAccess) {
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
Serializable cachedValue = null;
Object cachedValue = null;
eventListenerManager.cacheGetStart();
try {
cachedValue = (Serializable) cacheAccess.get( session, cacheKey );
cachedValue = cacheAccess.get( session, cacheKey );
}
finally {
eventListenerManager.cacheGetEnd( cachedValue != null );