From d996fdf168ca4a6e003f79efaa269f0c6e159cc4 Mon Sep 17 00:00:00 2001 From: jenny <88226911+kmjenny@users.noreply.github.com> Date: Sat, 17 Feb 2024 12:22:29 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#16=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/harang/server/domain/Location.java | 2 +- src/main/java/org/harang/server/service/PostService.java | 1 - src/main/resources/application.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/harang/server/domain/Location.java b/src/main/java/org/harang/server/domain/Location.java index 75fe3dc..f54751c 100644 --- a/src/main/java/org/harang/server/domain/Location.java +++ b/src/main/java/org/harang/server/domain/Location.java @@ -15,7 +15,7 @@ public class Location { @Column(name = "id", nullable = false) private Long id; - @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "post_id") private Post post; diff --git a/src/main/java/org/harang/server/service/PostService.java b/src/main/java/org/harang/server/service/PostService.java index b6ed0a5..34467cb 100644 --- a/src/main/java/org/harang/server/service/PostService.java +++ b/src/main/java/org/harang/server/service/PostService.java @@ -69,7 +69,6 @@ public Post createPost(Long memberId, PostRequest request) { @Transactional public void deletePost(Long memberId, Long postId) { Post post = postRepository.findByIdOrThrow(postId); - Location location = locationRepository.findByPostId(postId); locationRepository.deleteByPostId(postId); postRepository.delete(post); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4ec6372..a98fd60 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,7 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?useSSL=false&serverTimezone=Asia/Seoul&characterEncoding=UTF-8 + url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?useSSL=false&serverTimezone=Asia/Seoul&characterEncoding=UTF-8&allowPublicKeyRetrieval=true username: ${DB_USER} password: ${DB_PASSWORD}