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.AssertionFailure;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Interceptor;
|
import org.hibernate.Interceptor;
|
||||||
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
import org.hibernate.event.service.spi.EventListenerGroup;
|
||||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||||
|
|
|
@ -301,7 +301,7 @@ public class CacheEntityLoaderHelper {
|
||||||
|
|
||||||
private Object convertCacheReferenceEntryToEntity(
|
private Object convertCacheReferenceEntryToEntity(
|
||||||
ReferenceCacheEntryImpl referenceCacheEntry,
|
ReferenceCacheEntryImpl referenceCacheEntry,
|
||||||
EventSource session,
|
SharedSessionContractImplementor session,
|
||||||
EntityKey entityKey) {
|
EntityKey entityKey) {
|
||||||
final Object entity = referenceCacheEntry.getReference();
|
final Object entity = referenceCacheEntry.getReference();
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ public class CacheEntityLoaderHelper {
|
||||||
|
|
||||||
private void makeEntityCircularReferenceSafe(
|
private void makeEntityCircularReferenceSafe(
|
||||||
ReferenceCacheEntryImpl referenceCacheEntry,
|
ReferenceCacheEntryImpl referenceCacheEntry,
|
||||||
EventSource session,
|
SharedSessionContractImplementor session,
|
||||||
Object entity,
|
Object entity,
|
||||||
EntityKey entityKey) {
|
EntityKey entityKey) {
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import org.hibernate.LockMode;
|
||||||
import org.hibernate.NotYetImplementedFor6Exception;
|
import org.hibernate.NotYetImplementedFor6Exception;
|
||||||
import org.hibernate.engine.spi.EntityKey;
|
import org.hibernate.engine.spi.EntityKey;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
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.event.spi.EventSource;
|
||||||
import org.hibernate.internal.log.LoggingHelper;
|
import org.hibernate.internal.log.LoggingHelper;
|
||||||
import org.hibernate.loader.entity.CacheEntityLoaderHelper;
|
import org.hibernate.loader.entity.CacheEntityLoaderHelper;
|
||||||
|
@ -104,7 +106,7 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp
|
||||||
final Object cachedEntity;
|
final Object cachedEntity;
|
||||||
if ( concreteDescriptor.getEntityMetamodel().hasSubclasses() ) {
|
if ( concreteDescriptor.getEntityMetamodel().hasSubclasses() ) {
|
||||||
cachedEntity = CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache(
|
cachedEntity = CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache(
|
||||||
(EventSource) rowProcessingState.getSession(),
|
(SharedSessionContractImplementor) rowProcessingState.getSession(),
|
||||||
null,
|
null,
|
||||||
LockMode.NONE,
|
LockMode.NONE,
|
||||||
concreteDescriptor,
|
concreteDescriptor,
|
||||||
|
|
Loading…
Reference in New Issue