Skip to content

Commit

Permalink
HHH-15453 java.lang.NullPointerException: Cannot invoke org.hibernate…
Browse files Browse the repository at this point in the history
….engine.spi.EntityEntry.getEntityKey() because ownerEntry is null
  • Loading branch information
dreab8 authored and beikov committed Aug 24, 2022
1 parent ed4f399 commit d862b08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ else if ( !session.isConnected() ) {
}
}
else {
if ( !session.isTransactionInProgress() ) {
/*
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() ) {
session.getJdbcCoordinator().afterTransaction();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,23 @@ protected void resolveInstance(RowProcessingState rowProcessingState, boolean is

if ( loadingEntry != null ) {
collectionInstance = loadingEntry.getCollectionInstance();
if ( collectionInstance.getOwner() == null ) {
parentAccess.registerResolutionListener(
owner -> collectionInstance.setOwner( owner )
);
}
return;
}

final PersistentCollection<?> existing = persistenceContext.getCollection( collectionKey );

if ( existing != null ) {
collectionInstance = existing;
if ( collectionInstance.getOwner() == null ) {
parentAccess.registerResolutionListener(
owner -> collectionInstance.setOwner( owner )
);
}
return;
}

Expand Down

0 comments on commit d862b08

Please sign in to comment.