public static void main(String[] args) { Personnel p1 = creePersonnel( "Durand", "Marcel", new Date() ); EntityManagerFactory emf = Persistence.createEntityManagerFactory("TestJava8MysqlPU"); EntityManager em = emf.createEntityManager(); EntityTransaction tr = em.getTransaction(); tr.begin(); em.persist(p1); tr.commit(); em.close(); emf.close(); } public static Personnel creePersonnel( String nom, String prenom, Date neLe ) { Personnel p = new Personnel(); p.setNom(nom); p.setPrenom(prenom); p.setNeLe(neLe); return p; }