1.Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
List<Comment> findCommentsByNoticeOrderByDateDesc(Notice notice);
}
정말 간단하게 해결했다.
원래같았으면 쿼리문을 사용해야되는 것을 JPA에서 변수명만 넣으면 생성해준다.
참고 사이트
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods