/** * Extract the requested persistence provider name using the algorithm Hibernate uses. Namely, a provider named * in the 'integration' map (under the key '{@value AvailableSettings#JPA_PERSISTENCE_PROVIDER}') is preferred, as per-spec, over * value specified in persistence unit. * * @param persistenceUnit The {@code <persistence-unit/>} descriptor. * @param integration The integration values. * * @return The extracted provider name, or {@code null} if none found. */ public static String extractRequestedProviderName(PersistenceUnitDescriptor persistenceUnit, Map integration) { final String integrationProviderName = extractProviderName( integration ); if ( integrationProviderName != null ) { log.debugf( "Integration provided explicit PersistenceProvider [%s]", integrationProviderName ); return integrationProviderName; } final String persistenceUnitRequestedProvider = extractProviderName( persistenceUnit ); if ( persistenceUnitRequestedProvider != null ) { log.debugf( "Persistence-unit [%s] requested PersistenceProvider [%s]", persistenceUnit.getName(), persistenceUnitRequestedProvider ); return persistenceUnitRequestedProvider; } // NOTE : if no provider requested we assume we are the provider (the calls got to us somehow...) log.debug( "No PersistenceProvider explicitly requested, assuming Hibernate" ); return HibernatePersistenceProvider.class.getName(); }
/** * Extract the requested persistence provider name using the algorithm Hibernate uses. Namely, a provider named * in the 'integration' map (under the key '{@value AvailableSettings#JPA_PERSISTENCE_PROVIDER}') is preferred, as per-spec, over * value specified in persistence unit. * * @param persistenceUnit The {@code <persistence-unit/>} descriptor. * @param integration The integration values. * * @return The extracted provider name, or {@code null} if none found. */ public static String extractRequestedProviderName(PersistenceUnitDescriptor persistenceUnit, Map integration) { final String integrationProviderName = extractProviderName( integration ); if ( integrationProviderName != null ) { log.debugf( "Integration provided explicit PersistenceProvider [%s]", integrationProviderName ); return integrationProviderName; } final String persistenceUnitRequestedProvider = extractProviderName( persistenceUnit ); if ( persistenceUnitRequestedProvider != null ) { log.debugf( "Persistence-unit [%s] requested PersistenceProvider [%s]", persistenceUnit.getName(), persistenceUnitRequestedProvider ); return persistenceUnitRequestedProvider; } // NOTE : if no provider requested we assume we are the provider (the calls got to us somehow...) log.debug( "No PersistenceProvider explicitly requested, assuming Hibernate" ); return HibernatePersistenceProvider.class.getName(); }