HHH-7212 - Fix
This commit is contained in:
parent
d33d481b52
commit
dafe837487
|
@ -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