Skip to content

Commit

Permalink
refactor: Product에서 preRemove 추가 #206
Browse files Browse the repository at this point in the history
  • Loading branch information
jjt4515 committed Nov 15, 2024
1 parent d4890e5 commit 0d58a98
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/poomasi/domain/product/entity/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public class Product {
@OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
private ProductIntro productIntro;

// @PreRemove
// public void preRemove() {
// // Product가 삭제되기 전에 연관된 이미지를 삭제
// for (Image image : images) {
// image.setDeletedAt(LocalDateTime.now());
// }
// }
@PreRemove
public void preRemove() {
// Product가 삭제되기 전에 연관된 이미지를 삭제
for (Image image : images) {
image.setDeletedAt(LocalDateTime.now());
}
}

@Builder
public Product(Long productId,
Expand Down

0 comments on commit 0d58a98

Please sign in to comment.