From ffc498d7e3191bf5e0f35f6d1e379200ee6092ce Mon Sep 17 00:00:00 2001 From: sergioqfeg1 Date: Sat, 6 Apr 2024 15:00:47 +0200 Subject: [PATCH] fix: problem with QuestionRepository sql --- .../en2b/quizapi/questions/question/QuestionRepository.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionRepository.java b/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionRepository.java index 7c1b6f19..35c61d92 100644 --- a/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionRepository.java +++ b/api/src/main/java/lab/en2b/quizapi/questions/question/QuestionRepository.java @@ -4,9 +4,6 @@ import org.springframework.data.jpa.repository.Query; public interface QuestionRepository extends JpaRepository { - /*@Query(value = "SELECT q.* FROM questions q INNER JOIN answers a ON q.correct_answer_id=a.id WHERE a.language = ?1 ORDER BY RANDOM() LIMIT 1", nativeQuery = true) - Question findRandomQuestion(String lang);*/ - - @Query(value = "SELECT q.* FROM questions q INNER JOIN answers a ON q.correct_answer_id=a.id WHERE q.language = ?1 ORDER BY RANDOM() LIMIT 1", nativeQuery = true) + @Query(value = "SELECT q.* FROM questions q INNER JOIN answers a ON q.correct_answer_id=a.id WHERE a.language = ?1 ORDER BY RANDOM() LIMIT 1", nativeQuery = true) Question findRandomQuestion(String lang); }