Skip to content

Commit f120cd2

Browse files
committed
HHH-11555 - AbstractSharedSessionContract doesn't restore ExceptionConverter after de-serialization
1 parent d9ef8fc commit f120cd2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
131131
private transient Boolean useStreamForLobBinding;
132132
private transient long timestamp;
133133

134-
private transient Integer jdbcBatchSize;
134+
private Integer jdbcBatchSize;
135135

136136
protected transient ExceptionConverter exceptionConverter;
137137

@@ -1063,5 +1063,6 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
10631063
.buildTransactionCoordinator( jdbcCoordinator, this );
10641064

10651065
entityNameResolver = new CoordinatingEntityNameResolver( factory, interceptor );
1066+
exceptionConverter = new ExceptionConverterImpl( this );
10661067
}
10671068
}

hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ public final class SessionImpl
230230
// todo : (5.2) HEM always initialized this. Is that really needed?
231231
private LockOptions lockOptions = new LockOptions();
232232

233-
private transient boolean autoClear;
234-
private transient boolean autoClose;
233+
private boolean autoClear;
234+
private boolean autoClose;
235235

236236
private transient int dontFlushFromFind;
237237
private transient boolean disallowOutOfTransactionUpdateOperations;
@@ -3888,5 +3888,10 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
38883888
for ( String filterName : loadQueryInfluencers.getEnabledFilterNames() ) {
38893889
( (FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName ) ).afterDeserialize( getFactory() );
38903890
}
3891+
3892+
initializeFromSessionOwner( null );
3893+
3894+
this.disallowOutOfTransactionUpdateOperations = !getFactory().getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations();
3895+
this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled();
38913896
}
38923897
}

0 commit comments

Comments
 (0)