Fix java.lang.ClassCastException: org.hibernate.internal.StatelessSessionImpl cannot be cast to org.hibernate.event.spi.EventSource
This commit is contained in:
parent
a3920e5892
commit
7eccda9f36
|
@ -11,6 +11,7 @@ import java.io.Serializable;
|
|||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||
|
|
|
@ -301,7 +301,7 @@ public class CacheEntityLoaderHelper {
|
|||
|
||||
private Object convertCacheReferenceEntryToEntity(
|
||||
ReferenceCacheEntryImpl referenceCacheEntry,
|
||||
EventSource session,
|
||||
SharedSessionContractImplementor session,
|
||||
EntityKey entityKey) {
|
||||
final Object entity = referenceCacheEntry.getReference();
|
||||
|
||||
|
@ -317,7 +317,7 @@ public class CacheEntityLoaderHelper {
|
|||
|
||||
private void makeEntityCircularReferenceSafe(
|
||||
ReferenceCacheEntryImpl referenceCacheEntry,
|
||||
EventSource session,
|
||||
SharedSessionContractImplementor session,
|
||||
Object entity,
|
||||
EntityKey entityKey) {
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ import org.hibernate.LockMode;
|
|||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.EntityKey;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.log.LoggingHelper;
|
||||
import org.hibernate.loader.entity.CacheEntityLoaderHelper;
|
||||
|
@ -104,7 +106,7 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp
|
|||
final Object cachedEntity;
|
||||
if ( concreteDescriptor.getEntityMetamodel().hasSubclasses() ) {
|
||||
cachedEntity = CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache(
|
||||
(EventSource) rowProcessingState.getSession(),
|
||||
(SharedSessionContractImplementor) rowProcessingState.getSession(),
|
||||
null,
|
||||
LockMode.NONE,
|
||||
concreteDescriptor,
|
||||
|
|
Loading…
Reference in New Issue