public void initializePersistenceStrategy ( CacheMappingType cacheMappingType , Set < EntityKeyMetadata > entityTypes , Set < AssociationKeyMetadata > associationTypes , Set < IdSourceKeyMetadata > idSourceTypes , Iterable < Namespace > namespaces ) { persistenceStrategy = PersistenceStrategy . getInstance ( cacheMappingType , externalCacheManager , config . getConfigurationUrl ( ) , jtaPlatform , entityTypes , associationTypes , idSourceTypes ) ; // creates handler for TableGenerator Id sources boolean requiresCounter = hasIdGeneration ( idSourceTypes ) ; if ( requiresCounter ) { this . tableClusterHandler = new TableClusteredCounterHandler ( persistenceStrategy . getCacheManager ( ) . getCacheManager ( ) ) ; } // creates handlers for SequenceGenerator Id sources for ( Namespace namespace : namespaces ) { for ( Sequence seq : namespace . getSequences ( ) ) { this . sequenceCounterHandlers . put ( seq . getExportIdentifier ( ) , new SequenceClusteredCounterHandler ( persistenceStrategy . getCacheManager ( ) . getCacheManager ( ) , seq ) ) ; } } // clear resources this . externalCacheManager = null ; this . jtaPlatform = null ; }
Initializes the persistence strategy to be used when accessing the datastore . In particular all the required caches will be configured and initialized .