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; +}