/** * 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() { } }); }