mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-28 23:09:13 +00:00
HHH-13450 Do not compute the full role name of a collection unless necessary
This commit is contained in:
parent
3cc9e8f284
commit
44c13af23b
@ -381,7 +381,7 @@ private static Boolean getOverridingEager(
|
||||
String associationName,
|
||||
Type type) {
|
||||
if ( type.isAssociationType() || type.isCollectionType() ) {
|
||||
Boolean overridingEager = isEagerFetchProfile( session, entityName + "." + associationName );
|
||||
Boolean overridingEager = isEagerFetchProfile( session, entityName, associationName );
|
||||
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
if ( overridingEager != null ) {
|
||||
@ -399,9 +399,13 @@ private static Boolean getOverridingEager(
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Boolean isEagerFetchProfile(SharedSessionContractImplementor session, String role) {
|
||||
private static Boolean isEagerFetchProfile(SharedSessionContractImplementor session, String entityName, String associationName) {
|
||||
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() ) {
|
||||
FetchProfile fp = session.getFactory().getFetchProfile( fetchProfileName );
|
||||
Fetch fetch = fp.getFetchByRole( role );
|
||||
@ -409,6 +413,7 @@ private static Boolean isEagerFetchProfile(SharedSessionContractImplementor sess
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ protected final boolean isJoinFetchEnabledByProfile(OuterJoinLoadable persister,
|
||||
String relativePropertyPath = pos >= 0
|
||||
? fullPath.substring( pos )
|
||||
: rootPropertyName;
|
||||
String fetchRole = persister.getEntityName() + "." + relativePropertyPath;
|
||||
String fetchRole = persister.getEntityName() + '.' + relativePropertyPath;
|
||||
|
||||
for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) {
|
||||
final FetchProfile profile = getFactory().getFetchProfile( profileName );
|
||||
|
@ -58,7 +58,7 @@ public static FetchStyle determineFetchStyleByProfile(
|
||||
final String relativePropertyPath = pos >= 0
|
||||
? fullPath.substring( pos )
|
||||
: rootPropertyName;
|
||||
final String fetchRole = persister.getEntityName() + "." + relativePropertyPath;
|
||||
final String fetchRole = persister.getEntityName() + '.' + relativePropertyPath;
|
||||
|
||||
for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
|
||||
final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName );
|
||||
|
Loading…
x
Reference in New Issue
Block a user