无法解析javax.persistence.spi.PersistenceProvider

时间:2014-03-19 07:34:54

标签: spring-mvc

无法解析javax.persistence.spi.PersistenceProvider类型。它是从所需的.class文件间接引用的

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
        entityManagerFactoryBean.setDataSource(dataSource());
        entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);// getting error at this line

        entityManagerFactoryBean.setJpaProperties(hibProperties());

        return entityManagerFactoryBean;
    }

1 个答案:

答案 0 :(得分:1)

如果你仍然遇到这个问题,可以在hibernate-jpa-2.0-api.jar中找到适用于Hibernate 4.0.1.Final的PersistenceProvider类。 Maven会自动为您解决依赖关系。