Skip to content

Commit 239014d

Browse files
committed
HHH-17826 ResultSet closed while scrolling results
1 parent 27a9ec2 commit 239014d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,20 @@ private void prepareCurrentRow(boolean underlyingScrollSuccessful) {
129129
loadContexts.register( getJdbcValuesSourceProcessingState() );
130130
persistenceContext.beforeLoad();
131131
try {
132-
currentRow = getRowReader().readRow( getRowProcessingState(), getProcessingOptions() );
133-
134-
getRowProcessingState().finishRowProcessing();
135-
getJdbcValuesSourceProcessingState().finishUp( false );
132+
try {
133+
currentRow = getRowReader().readRow( getRowProcessingState(), getProcessingOptions() );
134+
135+
getRowProcessingState().finishRowProcessing( );
136+
getJdbcValuesSourceProcessingState().finishUp( false );
137+
}
138+
finally {
139+
persistenceContext.afterLoad();
140+
}
141+
persistenceContext.initializeNonLazyCollections();
136142
}
137143
finally {
138-
persistenceContext.afterLoad();
139144
loadContexts.deregister( getJdbcValuesSourceProcessingState() );
140145
}
141-
persistenceContext.initializeNonLazyCollections();
142146

143147
afterScrollOperation();
144148
}

0 commit comments

Comments
 (0)