TODO : merge

This commit is contained in:
trochas
2025-09-19 09:47:10 +02:00
parent 78603b2d26
commit aabaed6755
13 changed files with 125 additions and 7 deletions

View File

@@ -1 +1,38 @@
# Template de projet pour le TP JPA UniR # Template de projet pour le TP JPA UniR
```mermaid
classDiagram
Utilisateur "*" -- "*" Session
Session "*" -- "1" Quizz
Quizz "1" -- "1..*" Question
Utilisateur "1" -- "*" Quizz
Question "1" -- "1..*" Reponse
Reponse <|-- ReponseCourte
Reponse <|-- Choix
class Utilisateur {
-id : int
name : String
}
class Session{
-id : int
}
class Quizz{
-id : int
}
class Reponse{
- id : int
}
class Choix{
- id : int
choix : List<String>
}
class ReponseCourte{
- id : int
value : String
}
class Question{
- id : int
}
```

View File

@@ -9,7 +9,7 @@ public class Choix extends Reponse{
@Id @Id
@GeneratedValue @GeneratedValue
int id; private int id;
ArrayList<String> choix; ArrayList<String> choix;
@@ -17,6 +17,14 @@ public class Choix extends Reponse{
super(); super();
} }
public void setId(int id){
this.id=id;
}
public int getId(){
return this.id;
}

View File

@@ -12,10 +12,12 @@ public class Question {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private int id; private int id;
@OneToMany(mappedBy ="reponse", cascade = CascadeType.DETACH)
private Reponse reponse; private Reponse reponse;
@Id
@GeneratedValue
public int getId() { public int getId() {
return id; return id;
} }
@@ -23,7 +25,6 @@ public class Question {
this.id = id; this.id = id;
} }
@OneToMany(mappedBy ="reponse", cascade = CascadeType.DETACH)
public Reponse getReponse() { public Reponse getReponse() {
return reponse; return reponse;
} }
@@ -31,4 +32,5 @@ public class Question {
public void setReponse(Reponse reponse) { public void setReponse(Reponse reponse) {
this.reponse = reponse; this.reponse = reponse;
} }
} }

View File

@@ -10,7 +10,7 @@ public class Quizz{
@Id @Id
@GeneratedValue @GeneratedValue
public int id; private int id;
@ManyToOne @ManyToOne
@JoinColumn(name="id_utilisateur") @JoinColumn(name="id_utilisateur")
@@ -19,4 +19,21 @@ public class Quizz{
public Quizz(){ public Quizz(){
super(); super();
} }
public void setId(int id){
this.id=id;
}
public int getId(){
return this.id;
}
public void setutilisateur(Utilisateur utilisateur){
this.utilisateur=utilisateur;
}
public Utilisateur getUtilisateur(){
return this.utilisateur;
}
} }

View File

@@ -2,7 +2,6 @@ package metier;
import java.util.ArrayList; import java.util.ArrayList;
import javax.annotation.processing.Generated;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType; import jakarta.persistence.GenerationType;
@@ -19,4 +18,21 @@ public abstract class Reponse {
public Reponse(){ public Reponse(){
} }
public void setId(int id){
this.id=id;
}
public int getId(){
return this.id;
}
public void setReponses(ArrayList<String> reponses){
this.reponses=reponses;
}
public ArrayList<String> getReponses(){
return this.reponses;
}
} }

View File

@@ -8,7 +8,7 @@ public class ReponseCourte extends Reponse{
@Id @Id
@GeneratedValue @GeneratedValue
int id; private int id;
String value; String value;
@@ -17,4 +17,21 @@ public class ReponseCourte extends Reponse{
super(); super();
} }
public void setId(int id){
this.id=id;
}
public int getId(){
return this.id;
}
public void setValue(String value){
this.value=value;
}
public String getValue(){
return this.value;
}
} }

View File

@@ -9,6 +9,7 @@ public class Utilisateur{
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private int id; private int id;
private String name; private String name;
@ManyToMany @ManyToMany
@@ -42,4 +43,24 @@ public class Utilisateur{
public Session getSession() { public Session getSession() {
return session; return session;
} }
public void setSession(Session session){
this.session = session;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.