From f120cd26dfda07abb67cd774a6c67773619ecea7 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 8 Mar 2017 16:14:39 +0000 Subject: [PATCH] HHH-11555 - AbstractSharedSessionContract doesn't restore ExceptionConverter after de-serialization --- .../internal/AbstractSharedSessionContract.java | 3 ++- .../main/java/org/hibernate/internal/SessionImpl.java | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java index bfa7234fe8..df6184cb90 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -131,7 +131,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont private transient Boolean useStreamForLobBinding; private transient long timestamp; - private transient Integer jdbcBatchSize; + private Integer jdbcBatchSize; protected transient ExceptionConverter exceptionConverter; @@ -1063,5 +1063,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont .buildTransactionCoordinator( jdbcCoordinator, this ); entityNameResolver = new CoordinatingEntityNameResolver( factory, interceptor ); + exceptionConverter = new ExceptionConverterImpl( this ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index 41184982f6..e354db822f 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -230,8 +230,8 @@ public final class SessionImpl // todo : (5.2) HEM always initialized this. Is that really needed? private LockOptions lockOptions = new LockOptions(); - private transient boolean autoClear; - private transient boolean autoClose; + private boolean autoClear; + private boolean autoClose; private transient int dontFlushFromFind; private transient boolean disallowOutOfTransactionUpdateOperations; @@ -3888,5 +3888,10 @@ public final class SessionImpl for ( String filterName : loadQueryInfluencers.getEnabledFilterNames() ) { ( (FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName ) ).afterDeserialize( getFactory() ); } + + initializeFromSessionOwner( null ); + + this.disallowOutOfTransactionUpdateOperations = !getFactory().getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); + this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); } }