From 070e1543fd8215ee4292d67b6125049acb5c9f21 Mon Sep 17 00:00:00 2001 From: Minseong Park Date: Mon, 15 Jul 2024 19:08:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20base=20entity=20=EC=B6=A9=EB=8F=8C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../depromeet/spot/jpa/common/BaseEntity.java | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 infrastructure/jpa/src/main/java/org/depromeet/spot/jpa/common/BaseEntity.java diff --git a/infrastructure/jpa/src/main/java/org/depromeet/spot/jpa/common/BaseEntity.java b/infrastructure/jpa/src/main/java/org/depromeet/spot/jpa/common/BaseEntity.java deleted file mode 100644 index 7ab09ace..00000000 --- a/infrastructure/jpa/src/main/java/org/depromeet/spot/jpa/common/BaseEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.depromeet.spot.jpa.common.entity; - -import java.time.LocalDateTime; - -import jakarta.persistence.Column; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.MappedSuperclass; -import jakarta.persistence.PrePersist; -import jakarta.persistence.PreUpdate; - -import org.hibernate.annotations.Where; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -@Getter -@SuperBuilder -@MappedSuperclass -@AllArgsConstructor -@Where(clause = "deleted_at is null") -@EntityListeners(AuditingEntityListener.class) -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class BaseEntity { - - @Id - @Column(name = "id", nullable = false) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @Column(updatable = false, name = "created_at") - private LocalDateTime createdAt; - - @Column(name = "updated_at") - private LocalDateTime updatedAt; - - @Column(name = "deleted_at") - private LocalDateTime deletedAt; - - @PrePersist - public void prePersist() { - this.createdAt = LocalDateTime.now(); - this.updatedAt = LocalDateTime.now(); - } - - @PreUpdate - public void preUpdate() { - this.updatedAt = LocalDateTime.now(); - } - - public boolean isDeleted() { - return null != this.deletedAt; - } - - public void delete() { - this.deletedAt = LocalDateTime.now(); - } -}