1

我一直在使用 Objectify 进行数据存储持久性,但是由于某种原因,我需要在 JPA 中做一些事情,但是我收到了这个错误:

Caused by: java.lang.IllegalStateException: JPA PersistenceProvider returned null EntityManagerFactory - check your JPA provider setup!
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:253)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$6.run(AbstractAutowireCapableBeanFactory.java:1504)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1502)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    ... 51 more

DAO 实现代码:

@Repository("accountDao")
//@Transactional
public class AccountDaoImpl extends JpaDaoSupport implements AccountDao {

    private static Logger logger = Logger.getLogger(AccountDaoImpl.class);

    @Autowired
    public AccountDaoImpl(EntityManagerFactory entityManagerFactory) {
        super.setEntityManagerFactory(entityManagerFactory);
    }

    // DAO crud function code omitted

}

servlet-context.xml src/main/webapp/WEB-INF/spring/appServlet/

持久性.xml src/main/resources/META-INF

4

0 回答 0