HHH-11076 Log a warning if uninitialized collection unsets session when filters are enabled

This commit is contained in:
Christian Beikov 2021-03-02 11:36:54 +01:00
parent eb639a2d95
commit 1714c022e2
2 changed files with 8 additions and 0 deletions

View File

@ -656,6 +656,10 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
}
}
if ( allowLoadOutsideTransaction && !initialized && session.getLoadQueryInfluencers().hasEnabledFilters() ) {
final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() );
LOG.enabledFiltersWhenDetachFromSession( collectionInfoString );
}
this.session = null;
}
return true;

View File

@ -1856,4 +1856,8 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Ignoring ServiceConfigurationError caught while trying to instantiate service '%s'.", id = 505)
void ignoringServiceConfigurationError(Class<?> serviceContract, @Cause ServiceConfigurationError error);
@LogMessage(level = WARN)
@Message(value = "Detaching an uninitialized collection with enabled filters from a session: %s", id = 506)
void enabledFiltersWhenDetachFromSession(String collectionInfoString);
}