HHH-13191 - Avoid LazyInitializationException when session is waiting for
auto-close with JPA_PROXY_COMPLIANCE enabled.
This commit is contained in:
parent
3cf2b50911
commit
e07f1aa89b
|
@ -168,7 +168,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
|||
else if ( session == null ) {
|
||||
throw new LazyInitializationException( "could not initialize proxy [" + entityName + "#" + id + "] - no Session" );
|
||||
}
|
||||
else if ( !session.isOpen() ) {
|
||||
else if ( !session.isOpenOrWaitingForAutoClose() ) {
|
||||
throw new LazyInitializationException( "could not initialize proxy [" + entityName + "#" + id + "] - the owning Session was closed" );
|
||||
}
|
||||
else if ( !session.isConnected() ) {
|
||||
|
@ -344,7 +344,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
|||
"Proxy [" + entityName + "#" + id + "] is detached (i.e, session is null). The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
|
||||
);
|
||||
}
|
||||
if ( session.isClosed() ) {
|
||||
if ( !session.isOpenOrWaitingForAutoClose() ) {
|
||||
throw new SessionException(
|
||||
"Session is closed. The read-only/modifiable setting is only accessible when the proxy [" + entityName + "#" + id + "] is associated with an open session."
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue