Skip to content

Commit 623b323

Browse files
committed
CLAP-185 fix: @SQLDelete annotation 적용
1 parent 1d98999 commit 623b323

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/clap/server/adapter/outbound/persistense/CommentPersistenceAdapter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ public Comment saveComment(Comment comment) {
2929
CommentEntity commentEntity = commentRepository.save(commentPersistenceMapper.toEntity(comment));
3030
return commentPersistenceMapper.toDomain(commentEntity);
3131
}
32+
33+
@Override
34+
public void deleteComment(Comment comment) {
35+
commentRepository.delete(commentPersistenceMapper.toEntity(comment));
36+
}
3237
}

src/main/java/clap/server/adapter/outbound/persistense/entity/task/CommentEntity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
import lombok.Getter;
88
import lombok.NoArgsConstructor;
99
import lombok.experimental.SuperBuilder;
10+
import org.hibernate.annotations.SQLDelete;
1011

1112
@Entity
1213
@Table(name = "comment")
1314
@Getter
1415
@SuperBuilder
1516
@NoArgsConstructor(access = AccessLevel.PROTECTED)
17+
@SQLDelete(sql = "UPDATE Comment SET is_Deleted = true WHERE comment_id = ?")
1618
public class CommentEntity extends BaseTimeEntity {
1719
@Id
1820
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -34,5 +36,5 @@ public class CommentEntity extends BaseTimeEntity {
3436
private boolean isModified;
3537

3638
@Column(name="is_deleted", nullable = false)
37-
private boolean isDeleted;
39+
private boolean isDeleted = Boolean.FALSE;
3840
}

0 commit comments

Comments
 (0)