Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team.incube.flooding.domain.homebase.repository

import org.springframework.data.jpa.repository.EntityGraph
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
Expand Down Expand Up @@ -44,4 +45,7 @@ interface HomebaseReservationRepository : JpaRepository<HomebaseReservationJpaEn
@Param("reservationDate")
reservationDate: LocalDate,
): List<HomebaseReservationJpaEntity>

@EntityGraph(attributePaths = ["homebase"])
fun findAllByReservationDate(reservationDate: LocalDate): List<HomebaseReservationJpaEntity>
Comment on lines +49 to +50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The newly added findAllByReservationDate method using @EntityGraph is functionally identical to the existing findAllWithHomebaseByDate method (which uses JPQL with JOIN FETCH). To prevent code redundancy and maintain a clean repository interface, please remove the unused findAllWithHomebaseByDate method from this interface.

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GetHomebaseReservationService(

@Transactional(readOnly = true)
fun getReservationList(reservationDate: LocalDate): List<GetHomebaseResponse> {
val reservations = reservationRepository.findAllWithHomebaseByDate(reservationDate)
val reservations = reservationRepository.findAllByReservationDate(reservationDate)
if (reservations.isEmpty()) return emptyList()
val membersByReservationId =
memberRepository
Expand Down
Loading