HHH-8543 - Complete org.hibernate.ejb.HibernatePersistence deprecation

This commit is contained in:
Steve Ebersole 2013-09-23 13:05:51 -05:00
parent 498735aa37
commit 0e40a9e6fc
3 changed files with 19 additions and 56 deletions

View File

@ -26,7 +26,8 @@ package org.hibernate.ejb;
import javax.persistence.spi.PersistenceProvider;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hibernate.jpa.internal.util.PersistenceUtilHelper;
import org.hibernate.jpa.internal.EntityManagerMessageLogger;
import org.hibernate.jpa.internal.HEMLogging;
/**
* Hibernate EJB3 persistence provider implementation
@ -37,59 +38,12 @@ import org.hibernate.jpa.internal.util.PersistenceUtilHelper;
*/
@Deprecated
public class HibernatePersistence extends HibernatePersistenceProvider implements PersistenceProvider, AvailableSettings {
private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache();
// /**
// * Get an entity manager factory by its entity manager name, using the specified
// * properties (they override any found in the peristence.xml file).
// * <p/>
// * This is the form used in JSE environments.
// *
// * @param persistenceUnitName entity manager name
// * @param properties The explicit property values
// *
// * @return initialized EntityManagerFactory
// */
// public EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
// Ejb3Configuration cfg = new Ejb3Configuration();
// Ejb3Configuration configured = cfg.configure( persistenceUnitName, properties );
// return configured != null ? configured.buildEntityManagerFactory() : null;
// }
// /**
// * Create an entity manager factory from the given persistence unit info, using the specified
// * properties (they override any on the PUI).
// * <p/>
// * This is the form used by the container in a JEE environment.
// *
// * @param info The persistence unit information
// * @param properties The explicit property values
// *
// * @return initialized EntityManagerFactory
// */
// public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) {
// Ejb3Configuration cfg = new Ejb3Configuration();
// Ejb3Configuration configured = cfg.configure( info, properties );
// return configured != null ? configured.buildEntityManagerFactory() : null;
// }
// private final ProviderUtil providerUtil = new ProviderUtil() {
// public LoadState isLoadedWithoutReference(Object proxy, String property) {
// return PersistenceUtilHelper.isLoadedWithoutReference( proxy, property, cache );
// }
//
// public LoadState isLoadedWithReference(Object proxy, String property) {
// return PersistenceUtilHelper.isLoadedWithReference( proxy, property, cache );
// }
//
// public LoadState isLoaded(Object o) {
// return PersistenceUtilHelper.isLoaded(o);
// }
// };
// public ProviderUtil getProviderUtil() {
// return providerUtil;
// }
private static final EntityManagerMessageLogger log = HEMLogging.messageLogger( HibernatePersistence.class );
public HibernatePersistence() {
log.deprecatedPersistenceProvider(
HibernatePersistence.class.getName(),
HibernatePersistenceProvider.class.getName()
);
}
}

View File

@ -124,4 +124,11 @@ public interface EntityManagerMessageLogger extends CoreMessageLogger {
value = "Encountered a MappedSuperclass [%s] not used in any entity hierarchy"
)
void unusedMappedSuperclass(String name);
@LogMessage( level = WARN )
@Message(
id = 15016,
value = "Encountered a deprecated javax.persistence.spi.PersistenceProvider [%s]; use [%s] instead."
)
void deprecatedPersistenceProvider(String deprecated, String replacement);
}

View File

@ -1 +1,3 @@
org.hibernate.jpa.HibernatePersistenceProvider
org.hibernate.jpa.HibernatePersistenceProvider
# The deprecated provider, logs warnings when used.
org.hibernate.ejb.HibernatePersistence