HHH-7212 - Fix
This commit is contained in:
parent
5327ac5396
commit
edfe8afaf1
|
@ -82,7 +82,7 @@ public class Tools {
|
|||
|
||||
|
||||
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 class Tools {
|
|||
}
|
||||
}
|
||||
|
||||
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…
Reference in New Issue