HHH-13450 Do not compute the full role name of a collection unless necessary
This commit is contained in:
parent
e13386769c
commit
7309cdeb66
|
@ -313,7 +313,7 @@ public final class TwoPhaseLoad {
|
||||||
String associationName,
|
String associationName,
|
||||||
Type type) {
|
Type type) {
|
||||||
if ( type.isAssociationType() || type.isCollectionType() ) {
|
if ( type.isAssociationType() || type.isCollectionType() ) {
|
||||||
Boolean overridingEager = isEagerFetchProfile( session, entityName + "." + associationName );
|
Boolean overridingEager = isEagerFetchProfile( session, entityName, associationName );
|
||||||
|
|
||||||
if ( LOG.isDebugEnabled() ) {
|
if ( LOG.isDebugEnabled() ) {
|
||||||
if ( overridingEager != null ) {
|
if ( overridingEager != null ) {
|
||||||
|
@ -331,9 +331,13 @@ public final class TwoPhaseLoad {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean isEagerFetchProfile(SharedSessionContractImplementor session, String role) {
|
private static Boolean isEagerFetchProfile(SharedSessionContractImplementor session, String entityName, String associationName) {
|
||||||
LoadQueryInfluencers loadQueryInfluencers = session.getLoadQueryInfluencers();
|
LoadQueryInfluencers loadQueryInfluencers = session.getLoadQueryInfluencers();
|
||||||
|
|
||||||
|
// Performance: avoid concatenating entityName + "." + associationName when there is no need,
|
||||||
|
// as otherwise this section becomes an hot allocation point.
|
||||||
|
if ( loadQueryInfluencers.hasEnabledFetchProfiles() ) {
|
||||||
|
final String role = entityName + '.' + associationName;
|
||||||
for ( String fetchProfileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
|
for ( String fetchProfileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
|
||||||
FetchProfile fp = session.getFactory().getFetchProfile( fetchProfileName );
|
FetchProfile fp = session.getFactory().getFetchProfile( fetchProfileName );
|
||||||
Fetch fetch = fp.getFetchByRole( role );
|
Fetch fetch = fp.getFetchByRole( role );
|
||||||
|
@ -341,6 +345,7 @@ public final class TwoPhaseLoad {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ public abstract class AbstractEntityJoinWalker extends JoinWalker {
|
||||||
String relativePropertyPath = pos >= 0
|
String relativePropertyPath = pos >= 0
|
||||||
? fullPath.substring( pos )
|
? fullPath.substring( pos )
|
||||||
: rootPropertyName;
|
: rootPropertyName;
|
||||||
String fetchRole = persister.getEntityName() + "." + relativePropertyPath;
|
String fetchRole = persister.getEntityName() + '.' + relativePropertyPath;
|
||||||
|
|
||||||
for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) {
|
for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) {
|
||||||
final FetchProfile profile = getFactory().getFetchProfile( profileName );
|
final FetchProfile profile = getFactory().getFetchProfile( profileName );
|
||||||
|
|
|
@ -58,7 +58,7 @@ public final class FetchStrategyHelper {
|
||||||
final String relativePropertyPath = pos >= 0
|
final String relativePropertyPath = pos >= 0
|
||||||
? fullPath.substring( pos )
|
? fullPath.substring( pos )
|
||||||
: rootPropertyName;
|
: rootPropertyName;
|
||||||
final String fetchRole = persister.getEntityName() + "." + relativePropertyPath;
|
final String fetchRole = persister.getEntityName() + '.' + relativePropertyPath;
|
||||||
|
|
||||||
for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
|
for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
|
||||||
final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName );
|
final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName );
|
||||||
|
|
Loading…
Reference in New Issue