mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-07 11:48:18 +00:00
HHH-7212 - Fix
This commit is contained in:
parent
5327ac5396
commit
edfe8afaf1
@ -82,7 +82,7 @@ public static Object getIdentifier(SessionImplementor session, String entityName
|
||||
|
||||
|
||||
public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy) {
|
||||
if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
|
||||
if (!proxy.getHibernateLazyInitializer().isUninitialized() || activeProxySession(proxy)) {
|
||||
return proxy.getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
|
||||
@ -102,6 +102,11 @@ public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactory
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean activeProxySession(HibernateProxy proxy) {
|
||||
Session session = (Session) proxy.getHibernateLazyInitializer().getSession();
|
||||
return session != null && session.isOpen() && session.isConnected();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clazz Class wrapped with a proxy or not.
|
||||
* @param <T> Class type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user