Skip to content

Commit

Permalink
refactor: fetch join 메서드 사용하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjin8678 committed Oct 19, 2023
1 parent bb0914f commit 8d9b68c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ private Stage findStageById(Long stageId) {

@Transactional(readOnly = true)
public StageTicketsResponse findStageTickets(Long stageId) {
return StageTicketsResponse.from(ticketRepository.findAllByStageId(stageId));
return StageTicketsResponse.from(ticketRepository.findAllByStageIdWithFetch(stageId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TicketServiceTest {
TicketFixture.ticket().id(1L).ticketType(TicketType.STUDENT).stage(stage).build(),
TicketFixture.ticket().id(2L).ticketType(TicketType.VISITOR).stage(stage).build()
);
given(ticketRepository.findAllByStageId(stageId))
given(ticketRepository.findAllByStageIdWithFetch(stageId))
.willReturn(tickets);

// when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TicketRepositoryTest {
ticketRepository.save(TicketFixture.ticket().stage(otherStage).build());

// when
List<Ticket> actual = ticketRepository.findAllByStageId(stage.getId());
List<Ticket> actual = ticketRepository.findAllByStageIdWithFetch(stage.getId());

// then
assertThat(actual).hasSize(2);
Expand Down

0 comments on commit 8d9b68c

Please sign in to comment.