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 2010-08-17 11:24:00 +02:00
parent b2e08eb32a
commit d515cbc561
1 changed files with 10 additions and 3 deletions

View File

@ -3190,7 +3190,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 );
@ -3316,7 +3323,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
@ -3327,7 +3334,7 @@ public abstract class AbstractEntityPersister
return createEntityLoader( lockOptions, session.getLoadQueryInfluencers() );
}
else {
return ( UniqueEntityLoader ) loaders.get( lockOptions.getLockMode() );
return ( UniqueEntityLoader ) getLoaders().get( lockOptions.getLockMode() );
}
}