HHH-12743 Cleanup some deprecated code from ProviderChecker

This commit is contained in:
Sanne Grinovero 2018-06-18 15:38:41 +01:00
parent 57ba794a62
commit 06174d8433
1 changed files with 4 additions and 17 deletions

View File

@ -8,7 +8,7 @@ package org.hibernate.jpa.boot.spi;
import java.util.Map;
import org.hibernate.jpa.AvailableSettings;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.jboss.logging.Logger;
@ -22,11 +22,6 @@ import org.jboss.logging.Logger;
public final class ProviderChecker {
private static final Logger log = Logger.getLogger( ProviderChecker.class );
@SuppressWarnings("deprecation")
private static String[] HIBERNATE_PROVIDER_NAMES = new String[] {
HibernatePersistenceProvider.class.getName()
};
/**
* Does the descriptor and/or integration request Hibernate as the
* {@link javax.persistence.spi.PersistenceProvider}? Note that in the case of no requested provider being named
@ -54,20 +49,12 @@ public final class ProviderChecker {
"Checking requested PersistenceProvider name [%s] against Hibernate provider names",
requestedProviderName
);
for ( String hibernateProviderName : HIBERNATE_PROVIDER_NAMES ) {
if ( requestedProviderName.equals( hibernateProviderName ) ) {
return true;
}
}
log.tracef( "Found no match against Hibernate provider names" );
return false;
return HibernatePersistenceProvider.class.getName().equals( requestedProviderName );
}
/**
* Extract the requested persistence provider name using the algorithm Hibernate uses. Namely, a provider named
* in the 'integration' map (under the key '{@value AvailableSettings#PROVIDER}') is preferred, as per-spec, over
* 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.
@ -101,7 +88,7 @@ public final class ProviderChecker {
if ( integration == null ) {
return null;
}
final String setting = (String) integration.get( AvailableSettings.PROVIDER );
final String setting = (String) integration.get( AvailableSettings.JPA_PERSISTENCE_PROVIDER );
return setting == null ? null : setting.trim();
}