From bf33da44f8990c38b712822a9b0d737305bcc75d Mon Sep 17 00:00:00 2001 From: strongmhk Date: Thu, 4 Jul 2024 22:29:46 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat:=20BaseEntity=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/dream/domain/common/BaseEntity.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/com/umc/dream/domain/common/BaseEntity.java diff --git a/src/main/java/com/umc/dream/domain/common/BaseEntity.java b/src/main/java/com/umc/dream/domain/common/BaseEntity.java new file mode 100644 index 0000000..eef2c63 --- /dev/null +++ b/src/main/java/com/umc/dream/domain/common/BaseEntity.java @@ -0,0 +1,24 @@ +package com.umc.dream.domain.common; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseEntity { + + @CreatedDate + @Column(updatable = false) + private LocalDateTime createdDate; + + @LastModifiedDate + private LocalDateTime lastModifiedDate; +}