From 1e13ef8e0a60ae333f2ce563132c9a33e375b224 Mon Sep 17 00:00:00 2001 From: parkduhwan Date: Fri, 30 Aug 2024 15:53:08 +0900 Subject: [PATCH] =?UTF-8?q?=ED=88=AC=EB=8D=B0=EC=9D=B4=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/healthylife/entity/HeartEntity.java | 4 ++-- .../com/example/healthylife/repository/HeartRepository.java | 2 +- .../java/com/example/healthylife/service/HeartService.java | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/healthylife/entity/HeartEntity.java b/src/main/java/com/example/healthylife/entity/HeartEntity.java index a0ce3b6..356053a 100644 --- a/src/main/java/com/example/healthylife/entity/HeartEntity.java +++ b/src/main/java/com/example/healthylife/entity/HeartEntity.java @@ -18,11 +18,11 @@ public class HeartEntity implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long heartSq; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_sq", nullable = false) private UserEntity user; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "today_sq", nullable = false) private TodayEntity today; diff --git a/src/main/java/com/example/healthylife/repository/HeartRepository.java b/src/main/java/com/example/healthylife/repository/HeartRepository.java index 29f0bf0..bec8ae5 100644 --- a/src/main/java/com/example/healthylife/repository/HeartRepository.java +++ b/src/main/java/com/example/healthylife/repository/HeartRepository.java @@ -9,7 +9,7 @@ import java.util.Optional; public interface HeartRepository extends JpaRepository { - Optional findByUserAndToday(UserEntity user, TodayEntity today); boolean existsByUserAndToday(UserEntity user, TodayEntity today); + Optional findByUserAndToday(UserEntity user, TodayEntity today); } diff --git a/src/main/java/com/example/healthylife/service/HeartService.java b/src/main/java/com/example/healthylife/service/HeartService.java index 3e57676..cc46786 100644 --- a/src/main/java/com/example/healthylife/service/HeartService.java +++ b/src/main/java/com/example/healthylife/service/HeartService.java @@ -10,8 +10,6 @@ import org.springframework.stereotype.Service; import javax.transaction.Transactional; -import java.time.LocalDateTime; -import java.util.Optional; @RequiredArgsConstructor @Service