HHH-15651 Logging guard improvements in StatefulPersistenceContext
This commit is contained in:
parent
bedbd402e6
commit
001de2b203
|
@ -1376,7 +1376,10 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
final EntityPersister persister = metamodel.getEntityDescriptor( entity );
|
||||
final CollectionPersister cp = metamodel.getCollectionDescriptor( entity + '.' + property );
|
||||
|
||||
// try cache lookup first
|
||||
//Extracted as we're logging within two hot loops
|
||||
final boolean debugEnabled = LOG.isDebugEnabled();
|
||||
|
||||
// try cache lookup first
|
||||
final Object parent = getParentsByChild( childEntity );
|
||||
if ( parent != null ) {
|
||||
final EntityEntry entityEntry = entityEntryContext.getEntityEntry( parent );
|
||||
|
@ -1389,10 +1392,12 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
final Object unMergedChild = mergeMap.get( childEntity );
|
||||
if ( unMergedInstance != null && unMergedChild != null ) {
|
||||
index = getIndexInParent( property, unMergedChild, persister, cp, unMergedInstance );
|
||||
LOG.debugf(
|
||||
"A detached object being merged (corresponding to a parent in parentsByChild) has an indexed collection that [%s] the detached child being merged. ",
|
||||
( index != null ? "contains" : "does not contain" )
|
||||
);
|
||||
if ( debugEnabled ) {
|
||||
LOG.debugf(
|
||||
"A detached object being merged (corresponding to a parent in parentsByChild) has an indexed collection that [%s] the detached child being merged. ",
|
||||
( index != null ? "contains" : "does not contain" )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( index != null ) {
|
||||
|
@ -1417,10 +1422,12 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
final Object unMergedChild = mergeMap.get( childEntity );
|
||||
if ( unMergedInstance != null && unMergedChild!=null ) {
|
||||
index = getIndexInParent( property, unMergedChild, persister, cp, unMergedInstance );
|
||||
LOG.debugf(
|
||||
"A detached object being merged (corresponding to a managed entity) has an indexed collection that [%s] the detached child being merged. ",
|
||||
(index != null ? "contains" : "does not contain" )
|
||||
);
|
||||
if ( debugEnabled ) {
|
||||
LOG.debugf(
|
||||
"A detached object being merged (corresponding to a managed entity) has an indexed collection that [%s] the detached child being merged. ",
|
||||
(index != null ? "contains" : "does not contain" )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue