From cadde84ac1609ac1a6ab16fb1f70865860780bf1 Mon Sep 17 00:00:00 2001 From: ahnsuyeon Date: Sun, 13 Oct 2024 19:10:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=EC=97=90=EC=84=9C=20=EB=8B=A4=EB=A5=B8=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=88=98=EC=A0=95=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/entity/ConcertEntity.java | 33 +++---------------- .../repository/entity/ConcertSeatEntity.java | 11 +------ .../repository/entity/RoundEntity.java | 11 +------ 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertEntity.java b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertEntity.java index 1bc7a36..d5ebdc5 100644 --- a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertEntity.java +++ b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertEntity.java @@ -1,7 +1,6 @@ package co.kr.ticketing.adminconcert.concert.repository.entity; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; import org.hibernate.annotations.ColumnDefault; @@ -67,9 +66,9 @@ public class ConcertEntity { private PlaceEntity placeEntity; @OneToMany(mappedBy = "concertEntity", fetch = FetchType.LAZY) - private final List roundEntities = new ArrayList<>(); + private List roundEntities; @OneToMany(mappedBy = "concertEntity", fetch = FetchType.LAZY) - private final List seatEntities = new ArrayList<>(); + private List seatEntities; @Builder public ConcertEntity(Long id, LocalDateTime createdAt, LocalDateTime updatedAt, String name, String detailInfo, @@ -87,32 +86,8 @@ public ConcertEntity(Long id, LocalDateTime createdAt, LocalDateTime updatedAt, this.lastRunningEndTime = lastRunningEndTime; this.openTime = openTime; this.placeEntity = placeEntity; - setRoundEntities(roundEntities); - setSeatEntities(seatEntities); - } - - public void setRoundEntities(List roundEntities) { - this.roundEntities.clear(); - if (roundEntities != null) { - this.roundEntities.addAll(roundEntities); - roundEntities.forEach(roundEntity -> { - if (roundEntity.getConcertEntity() != this) { - roundEntity.setConcertEntity(this); - } - }); - } - } - - public void setSeatEntities(List seatEntities) { - this.seatEntities.clear(); - if (seatEntities != null) { - this.seatEntities.addAll(seatEntities); - seatEntities.forEach(seatEntity -> { - if (seatEntity.getConcertEntity() != this) { - seatEntity.setConcertEntity(this); - } - }); - } + this.roundEntities = roundEntities; + this.seatEntities = seatEntities; } public static ConcertEntity from(Concert concert, PlaceEntity placeEntity) { diff --git a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertSeatEntity.java b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertSeatEntity.java index 8c3654d..79071f8 100644 --- a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertSeatEntity.java +++ b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/ConcertSeatEntity.java @@ -75,16 +75,7 @@ public ConcertSeatEntity(Long id, LocalDateTime createdAt, LocalDateTime updated this.rowNum = rowNum; this.floor = floor; this.state = state; - setConcertEntity(concertEntity); - } - - public void setConcertEntity(ConcertEntity concertEntity) { - if (concertEntity != null) { - this.concertEntity = concertEntity; - if (!concertEntity.getSeatEntities().contains(this)) { - concertEntity.getSeatEntities().add(this); - } - } + this.concertEntity = concertEntity; } public static ConcertSeatEntity from(ConcertEntity concertEntity, ConcertSeat concertSeat) { diff --git a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/RoundEntity.java b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/RoundEntity.java index 094e1bb..30ffabd 100644 --- a/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/RoundEntity.java +++ b/admin/admin-concert/src/main/java/co/kr/ticketing/adminconcert/concert/repository/entity/RoundEntity.java @@ -49,16 +49,7 @@ public RoundEntity(Long id, LocalDateTime createdAt, LocalDateTime updatedAt, Lo this.createdAt = createdAt; this.updatedAt = updatedAt; this.startDateTime = startDateTime; - setConcertEntity(concertEntity); - } - - void setConcertEntity(ConcertEntity concertEntity) { - if (concertEntity != null) { - this.concertEntity = concertEntity; - if (!concertEntity.getRoundEntities().contains(this)) { - concertEntity.getRoundEntities().add(this); - } - } + this.concertEntity = concertEntity; } public static RoundEntity from(ConcertEntity concertEntity, Round round) {