HHH-12631 Fix invalid tracev calls in DefaultResolveNaturalIdEventListener
This commit is contained in:
parent
152a8b30db
commit
f4483e3576
|
@ -22,7 +22,7 @@ import org.hibernate.pretty.MessageHelper;
|
||||||
/**
|
/**
|
||||||
* Defines the default load event listeners used by hibernate for loading entities
|
* Defines the default load event listeners used by hibernate for loading entities
|
||||||
* in response to generated load events.
|
* in response to generated load events.
|
||||||
*
|
*
|
||||||
* @author Eric Dalquist
|
* @author Eric Dalquist
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
* made to load the entity from the session-level cache. If not found there,
|
* made to load the entity from the session-level cache. If not found there,
|
||||||
* an attempt is made to locate it in second-level cache. Lastly, an
|
* an attempt is made to locate it in second-level cache. Lastly, an
|
||||||
* attempt is made to load it directly from the datasource.
|
* attempt is made to load it directly from the datasource.
|
||||||
*
|
*
|
||||||
* @param event The load event
|
* @param event The load event
|
||||||
*
|
*
|
||||||
* @return The loaded entity, or null.
|
* @return The loaded entity, or null.
|
||||||
|
@ -57,8 +57,9 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
final boolean traceEnabled = LOG.isTraceEnabled();
|
final boolean traceEnabled = LOG.isTraceEnabled();
|
||||||
if ( traceEnabled ) {
|
if ( traceEnabled ) {
|
||||||
LOG.tracev(
|
LOG.tracev(
|
||||||
"Attempting to resolve: {0}",
|
"Attempting to resolve: {0}#{1}",
|
||||||
MessageHelper.infoString( persister, event.getNaturalIdValues(), event.getSession().getFactory() )
|
MessageHelper.infoString( persister ),
|
||||||
|
event.getNaturalIdValues()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +67,9 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
if ( entityId != null ) {
|
if ( entityId != null ) {
|
||||||
if ( traceEnabled ) {
|
if ( traceEnabled ) {
|
||||||
LOG.tracev(
|
LOG.tracev(
|
||||||
"Resolved object in cache: {0}",
|
"Resolved object in cache: {0}#{1}",
|
||||||
MessageHelper.infoString( persister, event.getNaturalIdValues(), event.getSession().getFactory() )
|
MessageHelper.infoString( persister ),
|
||||||
|
event.getNaturalIdValues()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return entityId;
|
return entityId;
|
||||||
|
@ -75,8 +77,9 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
|
|
||||||
if ( traceEnabled ) {
|
if ( traceEnabled ) {
|
||||||
LOG.tracev(
|
LOG.tracev(
|
||||||
"Object not resolved in any cache: {0}",
|
"Object not resolved in any cache: {0}#{1}",
|
||||||
MessageHelper.infoString( persister, event.getNaturalIdValues(), event.getSession().getFactory() )
|
MessageHelper.infoString( persister ),
|
||||||
|
event.getNaturalIdValues()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +88,7 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to resolve the entity id corresponding to the event's natural id values from the session
|
* Attempts to resolve the entity id corresponding to the event's natural id values from the session
|
||||||
*
|
*
|
||||||
* @param event The load event
|
* @param event The load event
|
||||||
*
|
*
|
||||||
* @return The entity from the cache, or null.
|
* @return The entity from the cache, or null.
|
||||||
|
@ -100,7 +103,7 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
/**
|
/**
|
||||||
* Performs the process of loading an entity from the configured
|
* Performs the process of loading an entity from the configured
|
||||||
* underlying datasource.
|
* underlying datasource.
|
||||||
*
|
*
|
||||||
* @param event The load event
|
* @param event The load event
|
||||||
*
|
*
|
||||||
* @return The object loaded from the datasource, or null if not found.
|
* @return The object loaded from the datasource, or null if not found.
|
||||||
|
@ -112,13 +115,13 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
if ( stats ) {
|
if ( stats ) {
|
||||||
startTime = System.nanoTime();
|
startTime = System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Serializable pk = event.getEntityPersister().loadEntityIdByNaturalId(
|
final Serializable pk = event.getEntityPersister().loadEntityIdByNaturalId(
|
||||||
event.getOrderedNaturalIdValues(),
|
event.getOrderedNaturalIdValues(),
|
||||||
event.getLockOptions(),
|
event.getLockOptions(),
|
||||||
event.getSession()
|
event.getSession()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( stats ) {
|
if ( stats ) {
|
||||||
final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = event.getEntityPersister().getNaturalIdCacheAccessStrategy();
|
final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = event.getEntityPersister().getNaturalIdCacheAccessStrategy();
|
||||||
final String regionName = naturalIdCacheAccessStrategy == null ? null : naturalIdCacheAccessStrategy.getRegion().getName();
|
final String regionName = naturalIdCacheAccessStrategy == null ? null : naturalIdCacheAccessStrategy.getRegion().getName();
|
||||||
|
@ -128,7 +131,7 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
regionName,
|
regionName,
|
||||||
milliseconds );
|
milliseconds );
|
||||||
}
|
}
|
||||||
|
|
||||||
//PK can be null if the entity doesn't exist
|
//PK can be null if the entity doesn't exist
|
||||||
if (pk != null) {
|
if (pk != null) {
|
||||||
event.getSession().getPersistenceContext().getNaturalIdHelper().cacheNaturalIdCrossReferenceFromLoad(
|
event.getSession().getPersistenceContext().getNaturalIdHelper().cacheNaturalIdCrossReferenceFromLoad(
|
||||||
|
@ -137,7 +140,7 @@ public class DefaultResolveNaturalIdEventListener
|
||||||
event.getOrderedNaturalIdValues()
|
event.getOrderedNaturalIdValues()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pk;
|
return pk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue