change question and reponse to 1to1
This commit is contained in:
@@ -6,7 +6,7 @@ classDiagram
|
||||
Session "*" -- "1" Quizz
|
||||
Quizz "1" -- "1..*" Question
|
||||
Utilisateur "1" -- "*" Quizz
|
||||
Question "1" -- "1..*" Reponse
|
||||
Question "1" -- "1" Reponse
|
||||
Reponse <|-- ReponseCourte
|
||||
Reponse <|-- Choix
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package DAO;
|
||||
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.Query;
|
||||
import metier.Utilisateur;
|
||||
|
||||
public class UtilisateurDAO extends GenericDAOImpl<Integer, Utilisateur>{
|
||||
@@ -8,5 +10,13 @@ public class UtilisateurDAO extends GenericDAOImpl<Integer, Utilisateur>{
|
||||
this.setClass(Utilisateur.class);
|
||||
}
|
||||
|
||||
|
||||
public int 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.List;
|
||||
public class Utilisateur implements Serializable {
|
||||
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
private List<Session> session;
|
||||
private String email;
|
||||
|
||||
Reference in New Issue
Block a user