Skip to content

Commit

Permalink
prepersist 설정 복구
Browse files Browse the repository at this point in the history
  • Loading branch information
toad0403 committed Dec 25, 2023
1 parent 6af7066 commit c9ab810
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
Expand All @@ -17,6 +19,12 @@ public class BaseTimeEntity {
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@PrePersist
private void prePersist() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}

@PreUpdate
private void preUpdate() {
this.updatedAt = LocalDateTime.now();
Expand Down

0 comments on commit c9ab810

Please sign in to comment.