Skip to content

Commit

Permalink
fix: 컬렉션 데이터를 메모리 상에서 페이징으로 가져오던 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeuk520 committed Sep 29, 2024
1 parent 4b78421 commit aad97ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

public interface CourseRepository extends JpaRepository<Course, Long> {

@EntityGraph(attributePaths = "places")
Slice<Course> findAllCoursesByIsPublic(Pageable pageable, Character isPublic);

@EntityGraph(attributePaths = "places")
Expand All @@ -20,12 +19,11 @@ public interface CourseRepository extends JpaRepository<Course, Long> {
@Query("""
SELECT c
FROM Course c, Dibs d
LEFT JOIN FETCH c.places p
WHERE d.member.id = :memberId AND d.course.id = c.id AND c.isPublic = "Y"
ORDER BY d.createdAt DESC
""")
Slice<Course> findLikedCoursesByMemberId(Long memberId, Pageable pageable);

@EntityGraph(attributePaths = {"member", "places"})
@EntityGraph(attributePaths = "member")
Slice<Course> findMyCoursesByMemberId(Long memberId, Pageable pageable);
}
3 changes: 3 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ spring:
hibernate:
show_sql: true
format_sql: true
query:
fail_on_pagination_over_collection_fetch: true
default_batch_fetch_size: 10
h2:
console:
enabled: true
Expand Down

0 comments on commit aad97ef

Please sign in to comment.