change question and reponse to 1to1
This commit is contained in:
@@ -7,8 +7,6 @@ import java.io.Serializable;
|
|||||||
@Entity
|
@Entity
|
||||||
public class Question implements Serializable {
|
public class Question implements Serializable {
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
@OneToMany(mappedBy ="reponse", cascade = CascadeType.DETACH)
|
|
||||||
private Reponse reponse;
|
private Reponse reponse;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@@ -20,6 +18,8 @@ public class Question implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name ="bonne_reponse", referencedColumnName = "id")
|
||||||
public Reponse getReponse() {
|
public Reponse getReponse() {
|
||||||
return reponse;
|
return reponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import jakarta.persistence.*;
|
|||||||
@DiscriminatorValue("Reponse")
|
@DiscriminatorValue("Reponse")
|
||||||
public abstract class Reponse implements Serializable {
|
public abstract class Reponse implements Serializable {
|
||||||
private int id;
|
private int id;
|
||||||
private ArrayList<String> reponses;
|
private Question question;
|
||||||
|
|
||||||
public Reponse(){}
|
public Reponse(){}
|
||||||
|
|
||||||
@@ -25,12 +25,12 @@ public abstract class Reponse implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReponses(ArrayList<String> reponses){
|
@OneToOne
|
||||||
this.reponses=reponses;
|
public Question getQuestion(){
|
||||||
}
|
return this.question;
|
||||||
|
|
||||||
public ArrayList<String> getReponses(){
|
|
||||||
return this.reponses;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setQuestion(Question question){
|
||||||
|
this.question=question;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package metier;
|
package metier;
|
||||||
|
|
||||||
import jakarta.persistence.DiscriminatorValue;
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.PrimaryKeyJoinColumn;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("RCourte")
|
@PrimaryKeyJoinColumn(name = "RC_Id")
|
||||||
public class ReponseCourte extends Reponse{
|
public class ReponseCourte extends Reponse{
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user