package se.kits.gakusei.content.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import se.kits.gakusei.content.model.IncorrectAnswers;

import java.util.List;

public interface IncorrectAnswerRepository extends CrudRepository<IncorrectAnswers, Long> {

    List<IncorrectAnswers> getByQuizNugget_Id(Long id);

    @Query("SELECT COUNT(e)>0 from IncorrectAnswers e WHERE e.id = :id AND e.quizNugget.id = :quizNuggetId")
    boolean existsByIdAndQuizNuggetId(@Param("id") Long id, @Param("quizNuggetId") Long quizNuggetId);
}

@@ -74,143 +74,33 @@
 ata.
-jpa.repository.Query;%0Aimport org.springframework.data.repository.CrudRepository;%0Aimport org.springframework.data.repository.query.Param
+repository.CrudRepository
 ;%0Aim
@@ -331,218 +331,6 @@
 );%0A%0A
-    @Query(%22SELECT COUNT(e)%3E0 from IncorrectAnswers e WHERE e.id = :id AND e.quizNugget.id = :quizNuggetId%22)%0A    boolean existsByIdAndQuizNuggetId(@Param(%22id%22) Long id, @Param(%22quizNuggetId%22) Long quizNuggetId);%0A
 %7D%0A

remove custom exists query