Skip to content

Commit

Permalink
fix: enable updateAt createdAt
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdjww committed Jul 4, 2024
1 parent 2417b62 commit aa9a60f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
33 changes: 18 additions & 15 deletions src/main/java/com/hackathon/TimeLapse/common/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit aa9a60f

Please sign in to comment.