不推荐使用HibernatePersistence.class。此代码应替代什么?
import org.hibernate.ejb.HibernatePersistence
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);
entityManagerFactoryBean.setPackagesToScan(env.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
entityManagerFactoryBean.setJpaProperties(hibProperties());
return entityManagerFactoryBean;
}
最佳答案
它应该是。
org.hibernate.jpa.HibernatePersistenceProvider
作为提供者
http://docs.jboss.org/hibernate/orm/4.3/javadocs/