79106840

Date: 2024-10-20 10:34:32
Score: 0.5
Natty:
Report link

In MySQL, the LIMIT clause does not support named parameters like (:paramName). you should use positional parameters (?N), where N is the position of the argument in the method signature.

eg:

@Query(value = "SELECT q.id FROM question q WHERE q.category = :category ORDER BY RAND() LIMIT ?5", nativeQuery = true)
List<Integer> findRandomQuestionsByCategory(@Param("category") String category, int numQ);
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Naren D