From de7ce17f35142a86e8e0eebf81ea01cd4d46f9c8 Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Fri, 28 Jan 2011 12:32:02 -0600 Subject: [PATCH] HHH-5879 Improve AbstractEntityPersister to allow better subclassing in the loader area Make use of a getLoader() getter which is protected --- .../persister/entity/AbstractEntityPersister.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 3603d930bf..4bf021b0f2 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -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() ); } }