HHH-16120 Error advancing (next) ResultSet position
This commit is contained in:
parent
03406be47c
commit
010b8df7cd
|
@ -286,7 +286,11 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
|
|||
Whenever the collection lazy loading is triggered during the loading process,
|
||||
closing the connection will cause an error when RowProcessingStateStandardImpl#next() will be called.
|
||||
*/
|
||||
if ( !session.isTransactionInProgress() && session.getPersistenceContext().isLoadFinished() ) {
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContext();
|
||||
if ( !session.isTransactionInProgress()
|
||||
&& ( !persistenceContext.hasLoadContext()
|
||||
|| ( persistenceContext.hasLoadContext()
|
||||
&& persistenceContext.getLoadContexts().isLoadingFinished() ) ) ) {
|
||||
session.getJdbcCoordinator().afterTransaction();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,11 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
return loadContexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLoadContext() {
|
||||
return loadContexts != null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void addUnownedCollection(CollectionKey key, PersistentCollection collection) {
|
||||
// if ( unownedCollections == null ) {
|
||||
|
|
|
@ -58,6 +58,11 @@ public interface PersistenceContext {
|
|||
*/
|
||||
LoadContexts getLoadContexts();
|
||||
|
||||
default boolean hasLoadContext() {
|
||||
getLoadContexts();
|
||||
return true;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Add a collection which has no owner loaded
|
||||
// *
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.jboss.logging.Logger;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSourceProcessingState {
|
||||
private static final Logger log = Logger.getLogger( JdbcValuesSourceProcessingStateStandardImpl.class );
|
||||
|
||||
private final ExecutionContext executionContext;
|
||||
private final JdbcValuesSourceProcessingOptions processingOptions;
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.hibernate.engine.spi.CollectionKey;
|
|||
import org.hibernate.engine.spi.EntityKey;
|
||||
import org.hibernate.engine.spi.EntityUniqueKey;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.collections.StandardStack;
|
||||
|
@ -48,6 +47,10 @@ public class LoadContexts {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isLoadingFinished() {
|
||||
return jdbcValuesSourceProcessingStateStack.getRoot() == null;
|
||||
}
|
||||
|
||||
public LoadingEntityEntry findLoadingEntityEntry(final EntityKey entityKey) {
|
||||
return jdbcValuesSourceProcessingStateStack.findCurrentFirstWithParameter( entityKey, JdbcValuesSourceProcessingState::findLoadingEntityLocally );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue