findPostsThatUserCommentedAt(@Param("postIds") List postIds, Pageable pageable);"> findPostsThatUserCommentedAt(@Param("postIds") List postIds, Pageable pageable);"> findPostsThatUserCommentedAt(@Param("postIds") List postIds, Pageable pageable);">
@Query(
    value = "select p from Post p join fetch p.board join fetch p.user where p.id IN (:postIds)",
    countQuery = "select count(p) from Post p where p.id IN (:postIds)"
)
Page<Post> findPostsThatUserCommentedAt(@Param("postIds") List<Long> postIds, Pageable pageable);

다음과 같은 JPQL 쿼리에서 파라미터로 들어온 postIds가 빈 List일 때!

  • H2에서는 에러 없이 잘 된다!
  • MYSQL에서는 에러가 뜬다!

MYSQL의 문법 : In function 내에 파라미터는 필수

Reference

  • 빅토리 멘토님