Savez-vous pourquoi le tri ne fonctionne pas?
ID
Description
Entité Question
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Question)) {
return false;
}
Question other = (Question) obj;
if (id != other.id) {
return false;
}
return true;
}
Bean de support
@ManagedBean
@ViewScoped
public class QuestionBackingBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private QuestionLocal questionBean;
private List questions;
@Inject
private Question question;
private int questionParamId;
public List getQuestions() {
questions = questionBean.findAllQuestions();
return questions;
}
public void setQuestions(List questions) {
this.questions = questions;
}
public Question getQuestion() {
return question;
}
public void setQuestion(Question question) {
this.question = question;
}
public int getQuestionParamId() {
return questionParamId;
}
public void setQuestionParamId(int questionParamId) {
this.questionParamId = questionParamId;
}
public void init() {
question = questionBean.findQuestion(questionParamId);
}
public String addQuestion() {
questionBean.createQuestion(question);
return "../index.xhtml";
}
}