HHH-13027 : org.hibernate.ejb.HibernatePersistence can no longer be used as a persistence provider name

This commit is contained in:
Gail Badner 2018-10-12 12:41:13 -07:00 committed by Sanne Grinovero
parent 6e7c1100a6
commit 1763bfb51f
2 changed files with 13 additions and 1 deletions

View File

@ -114,7 +114,7 @@ public interface EntityManagerMessageLogger extends CoreMessageLogger {
@LogMessage(level = WARN)
@Message(
id = 15016,
value = "Encountered a deprecated javax.persistence.spi.PersistenceProvider [%s]; use [%s] instead."
value = "Encountered a deprecated javax.persistence.spi.PersistenceProvider [%s]; [%s] will be used instead."
)
void deprecatedPersistenceProvider(String deprecated, String replacement);

View File

@ -9,6 +9,8 @@ package org.hibernate.jpa.boot.spi;
import java.util.Map;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.internal.EntityManagerMessageLogger;
import org.hibernate.internal.HEMLogging;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.jboss.logging.Logger;
@ -20,6 +22,7 @@ import org.jboss.logging.Logger;
* @author Steve Ebersole
*/
public final class ProviderChecker {
private static final Logger log = Logger.getLogger( ProviderChecker.class );
/**
@ -49,6 +52,15 @@ public final class ProviderChecker {
"Checking requested PersistenceProvider name [%s] against Hibernate provider names",
requestedProviderName
);
final String deprecatedPersistenceProvider = "org.hibernate.ejb.HibernatePersistence";
if ( deprecatedPersistenceProvider.equals( requestedProviderName) ) {
HEMLogging.messageLogger( ProviderChecker.class )
.deprecatedPersistenceProvider(
deprecatedPersistenceProvider,
HibernatePersistenceProvider.class.getName()
);
return true;
}
return HibernatePersistenceProvider.class.getName().equals( requestedProviderName );
}