diff --git a/backend/src/main/java/com/isp/backend/domain/schedule/repository/ScheduleRepository.java b/backend/src/main/java/com/isp/backend/domain/schedule/repository/ScheduleRepository.java index 5891e71f..b322c3b5 100644 --- a/backend/src/main/java/com/isp/backend/domain/schedule/repository/ScheduleRepository.java +++ b/backend/src/main/java/com/isp/backend/domain/schedule/repository/ScheduleRepository.java @@ -12,8 +12,10 @@ public interface ScheduleRepository extends JpaRepository { Optional findByIdAndActivatedIsTrue(Long scheduleId); - @Query("SELECT s FROM Schedule s WHERE s.member = :member AND s.activated = true ORDER BY s.updatedAt DESC") + @Query("SELECT s FROM Schedule s LEFT JOIN FETCH s.country WHERE s.member = :member AND s.activated = true ORDER BY s.updatedAt DESC") List findSchedulesByMember(@Param("member") Member member); - List findTop5ByMemberOrderByIdDesc(Member member); + @Query("SELECT s FROM Schedule s LEFT JOIN FETCH s.scheduleDetails WHERE s.member = :member ORDER BY s.id DESC") + List findTop5ByMemberOrderByIdDescWithDetails(@Param("member") Member member); + }