Java 类javax.persistence.spi.PersistenceProviderResolver 实例源码
项目:trakxmap
文件:DB.java
/**
* fixes the warning (Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb
* .HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.)
*
* must be called before getting the EntityManagerFactory
*/
private static void fixDeprecatedHibernateWarning() {
PersistenceProviderResolverHolder.setPersistenceProviderResolver(new PersistenceProviderResolver() {
private final List<PersistenceProvider> providers_ =
Arrays.asList(new PersistenceProvider[]{new HibernatePersistenceProvider()});
@Override
public List<PersistenceProvider> getPersistenceProviders() {
return providers_;
}
@Override
public void clearCachedProviders() {
}
});
}