fix bug spring (h2 version + value var dans ReponseCourte)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package sample.data.jpa.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -9,6 +11,7 @@ import sample.data.jpa.metier.Quizz;
|
||||
import sample.data.jpa.service.QuizzDao;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/quizz")
|
||||
public class QuizzController {
|
||||
private QuizzDao qDao;
|
||||
|
||||
@@ -69,4 +72,22 @@ public class QuizzController {
|
||||
return "Question remove from Quizz " + id;
|
||||
}
|
||||
|
||||
@RequestMapping("/getAll")
|
||||
@ResponseBody
|
||||
public String getAll(){
|
||||
String res = "";
|
||||
|
||||
try {
|
||||
List<Quizz> quizzs = qDao.findAll();
|
||||
for (Quizz quizz : quizzs) {
|
||||
res+=quizz.getId() + " nbQuestion:" + quizz.getQuestions().size() + " \n";
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return "Error get all Quizz :" + ex.toString();
|
||||
}
|
||||
return "Quizz : \n" + res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user