We're updating the issue view to help you get more done. 

DefaultInitializeCollectionEventListener not finding collections in cache

Description

Recent commit to DefaultInitializeCollectionEventListener caused that even if a collection is found in cache sql query is executed. It works as expected when you have trace logging enabled.

if ( foundInCache && traceEnabled ) {
LOG.trace( "Collection initialized from cache" );
} else {
if ( traceEnabled ) {
LOG.trace( "Collection not cached" );
}
// database hit
ce.getLoadedPersister().initialize( ce.getLoadedKey(), source );
}

should be

if ( foundInCache ) {
if(traceEnabled) {
LOG.trace( "Collection initialized from cache" );
}
} else {

Environment

None

Status

Assignee

Brett Meyer

Reporter

Jiří Pejchal

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.2.1

Priority

Major