1

我正在用 JSF 做一个小项目,遇到了你可以在标题中看到的错误。我已经研究了一个多小时,但找不到它,有人可以帮我吗?

@PersistenceUnit
private EntityManagerFactory emf;
@PersistenceContext
private EntityManager em;

@Override
public Klant tryRegistreren(String naam, String email, String wachtwoord) {
    try {
        emf = Persistence.createEntityManagerFactory("RD_TravelshopPU");
        RequestDispatcher rd = null;
        em = emf.createEntityManager();

        Klant klant = new Klant();
        klant.setNaam(naam);
        klant.setEmail(email);
        klant.setWachtwoord(wachtwoord);

        em.getTransaction().begin();
        em.persist(klant);
        em.getTransaction().commit();

    } catch (NoResultException e) {
        return null;
    }
}
4

0 回答 0