HHH-5879 Improve AbstractEntityPersister to allow better subclassing in the loader area

Make use of a getLoader() getter which is protected
This commit is contained in:
Emmanuel Bernard 2011-01-28 12:32:02 -06:00 committed by JPAV
parent f93581115e
commit de7ce17f35
1 changed files with 10 additions and 3 deletions

View File

@ -3106,7 +3106,14 @@ public abstract class AbstractEntityPersister
}
private void createLoaders() {
//needed by subclasses to override the createLoader strategy
protected Map getLoaders() {
return loaders;
}
//Relational based Persisters should be content with this implementation
protected void createLoaders() {
final Map loaders = getLoaders();
loaders.put( LockMode.NONE, createEntityLoader( LockMode.NONE ) );
UniqueEntityLoader readLoader = createEntityLoader( LockMode.READ );
@ -3227,7 +3234,7 @@ public abstract class AbstractEntityPersister
// Next, we consider whether an 'internal' fetch profile has been set.
// This indicates a special fetch profile Hibernate needs applied
// (for its merge loading process e.g.).
return ( UniqueEntityLoader ) loaders.get( session.getLoadQueryInfluencers().getInternalFetchProfile() );
return ( UniqueEntityLoader ) getLoaders().get( session.getLoadQueryInfluencers().getInternalFetchProfile() );
}
else if ( isAffectedByEnabledFetchProfiles( session ) ) {
// If the session has associated influencers we need to adjust the
@ -3238,7 +3245,7 @@ public abstract class AbstractEntityPersister
return createEntityLoader( lockOptions, session.getLoadQueryInfluencers() );
}
else {
return ( UniqueEntityLoader ) loaders.get( lockOptions.getLockMode() );
return ( UniqueEntityLoader ) getLoaders().get( lockOptions.getLockMode() );
}
}