Quizz //TODO SESSION
This commit is contained in:
@@ -10,13 +10,23 @@ public class UtilisateurDAO extends GenericDAOImpl<Integer, Utilisateur>{
|
||||
this.setClass(Utilisateur.class);
|
||||
}
|
||||
|
||||
public int findByEmail(String email){
|
||||
public Utilisateur findByEmail(String email){
|
||||
EntityTransaction t=em.getTransaction();
|
||||
t.begin();
|
||||
Query query=em.createQuery("select u from Utilisateur u where u.email=:email");
|
||||
query.setParameter("email",email);
|
||||
Utilisateur u=(Utilisateur)query.getSingleResult();
|
||||
t.commit();
|
||||
return u.getId();
|
||||
return u;
|
||||
}
|
||||
|
||||
public Utilisateur findById(Integer id){
|
||||
EntityTransaction t=em.getTransaction();
|
||||
t.begin();
|
||||
Query query=em.createQuery("select u from Utilisateur u where u.id=:id");
|
||||
query.setParameter("id",id);
|
||||
Utilisateur u=(Utilisateur)query.getSingleResult();
|
||||
t.commit();
|
||||
return u;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user