java.lang.ClassNotFoundException: javax.persistence.Persistence 無法用 JPA 找到
我正在练习JPA API。我遇到了错误
java.lang.ClassNotFoundException: javax.persistence.Persistence cannot be found
我的代码如下:
EntityManagerFactory emf;
emf = Persistence.createEntityManagerFactory("mail");
EntityManager em = emf.createEntityManager();
Query query = em.createQuery("SELECT v FROM Version v");
List<Version> versions = query.getResultList();
行处的错误emf = Persistence.createEntityManagerFactory("mail");
任何解决方案?