public class LoginTest {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("IRCBotPU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Login lg = new Login();
lg.setPassword("password");
lg.setUserName("Rocky");
em.persist(lg);
em.flush();
Login st = em.find(Login.class, lg.getPassword());
System.out.println(st);
em.getTransaction().commit();
em.close();
emf.close();
}
}
I'm getting an Exception when I try to run this class
javax.persistence.PersistenceException: No Persistence provider for EntityManager named IRCBotPU:
No META-INF/persistence.xml was found in classpath.
META-INF/persistence.xml is in my classpath. I don't know what is the reason or this exception.
Persistence library is TopLink.