Skip to content

Commit

Permalink
[BE] N+1 Query 문제를 해결 (#227)
Browse files Browse the repository at this point in the history
refactor(ScheduleRepository): Schedule 조회 시 AvailableDate 정보도 함께 조회할 수 있도록 @entitygraph 적용
  • Loading branch information
seokmyungham authored Aug 14, 2024
1 parent 0ba5cc0 commit 2326bb9
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import java.util.List;
import kr.momo.domain.attendee.Attendee;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ScheduleRepository extends JpaRepository<Schedule, Long> {

@EntityGraph(attributePaths = {"availableDate"})
List<Schedule> findAllByAttendee(Attendee attendee);

@EntityGraph(attributePaths = {"availableDate"})
List<Schedule> findAllByAttendeeIn(List<Attendee> attendees);

void deleteAllByAttendee(Attendee attendee);
Expand Down

0 comments on commit 2326bb9

Please sign in to comment.