@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseTimeEntity {
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
}
의 코드를 상속받아서 사용하는 Entity를 생성 시
createdAt와 updatedAt의 값을 db에서 확인해보니 null값이 들어가 있었다.
해결방법
@SpringBootApplication
@EnableJpaAuditing
public class SummerApplication {
}
Main 클래스에 @EnableJpaAuditing 어노테이션을 추가하면 해결.