diff --git a/src/main/java/com/hackathon/TimeLapse/TimeLapseApplication.java b/src/main/java/com/hackathon/TimeLapse/TimeLapseApplication.java index 7b29feb..66ca12d 100644 --- a/src/main/java/com/hackathon/TimeLapse/TimeLapseApplication.java +++ b/src/main/java/com/hackathon/TimeLapse/TimeLapseApplication.java @@ -2,8 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @SpringBootApplication +@EnableJpaAuditing public class TimeLapseApplication { public static void main(String[] args) { diff --git a/src/main/java/com/hackathon/TimeLapse/common/BaseEntity.java b/src/main/java/com/hackathon/TimeLapse/common/BaseEntity.java index 5c96583..9c32cad 100644 --- a/src/main/java/com/hackathon/TimeLapse/common/BaseEntity.java +++ b/src/main/java/com/hackathon/TimeLapse/common/BaseEntity.java @@ -1,27 +1,30 @@ package com.hackathon.TimeLapse.common; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.MappedSuperclass; import java.time.LocalDateTime; + import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; @MappedSuperclass -@EntityListeners({AbstractMethodError.class}) +@EntityListeners(AuditingEntityListener.class) public abstract class BaseEntity { - @CreatedDate - private LocalDateTime createdAt; - @LastModifiedDate - private LocalDateTime updatedAt; + @CreatedDate + private LocalDateTime createdAt; + @LastModifiedDate + private LocalDateTime updatedAt; - public BaseEntity() { - } + public BaseEntity() { + } - public LocalDateTime getCreatedAt() { - return this.createdAt; - } + public LocalDateTime getCreatedAt() { + return this.createdAt; + } - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } }