jpa/subsystem/src/main/java/org/jboss/as/jpa/persistenceprovider/PersistenceProviderLoader.java
public static List<PersistenceProvider> loadProviderModuleByName(String moduleName) throws ModuleLoadException {
        final ModuleLoader moduleLoader = Module.getBootModuleLoader();
        Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
        final ServiceLoader<PersistenceProvider> serviceLoader =
            module.loadService(PersistenceProvider.class);
        List<PersistenceProvider> result = new ArrayList<>();
        if (serviceLoader != null) {
            for (PersistenceProvider provider1 : serviceLoader) {
                // persistence provider jar may contain multiple provider service implementations
                // save each provider
                PersistenceProviderResolverImpl.getInstance().addPersistenceProvider(provider1);
                result.add(provider1);
            }
        }
        return result;
    }
public static List<PersistenceProvider> loadProviderModuleByName(String moduleName) throws ModuleLoadException {
        final ModuleLoader moduleLoader = Module.getBootModuleLoader();
        Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
        final ServiceLoader<PersistenceProvider> serviceLoader =
            module.loadService(PersistenceProvider.class);
        List<PersistenceProvider> result = new ArrayList<>();
        if (serviceLoader != null) {
            for (PersistenceProvider provider1 : serviceLoader) {
                // persistence provider jar may contain multiple provider service implementations
                // save each provider
                PersistenceProviderResolverImpl.getInstance().addPersistenceProvider(provider1);
                result.add(provider1);
            }
        }
        return result;
    }
public static List < PersistenceProvider > loadProviderModuleByName ( String moduleName ) throws ModuleLoadException { final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; Module module = moduleLoader . loadModule ( ModuleIdentifier . fromString ( moduleName ) ) ; final ServiceLoader < PersistenceProvider > serviceLoader = module . loadService ( PersistenceProvider . class ) ; List < PersistenceProvider > result = new ArrayList <> ( ) ; if ( serviceLoader != null ) { for ( PersistenceProvider provider1 : serviceLoader ) { // persistence provider jar may contain multiple provider service implementations // save each provider PersistenceProviderResolverImpl . getInstance ( ) . addPersistenceProvider ( provider1 ) ; result . add ( provider1 ) ; } } return result ; }
Loads the specified JPA persistence provider module

@param moduleName is the static module to be loaded
@throws ModuleLoadException
@return list of persistence providers in specified module

Note: side effect of saving loaded persistence providers to static api in javax.persistence.spi.PersistenceProvider.
Loads the specified JPA persistence provider module