메모장
JPA @PrePersist, @PreUpdate 본문
// 생성되는 시점에 수행
@PrePersist
public void preInit() {
this.createdDate = LocalDateTime.now();
this.modifiedDate = LocalDateTime.now();
}
// 업데이트 되는 시점에 수행
@PreUpdate
public void preUpdate() {
this.modifiedDate = LocalDateTime.now();
}
'Java' 카테고리의 다른 글
JPA 저장된 정렬 정보 이용하여 리스트 조회 (0) | 2022.12.07 |
---|---|
소수점 0 제거 (0) | 2022.11.24 |
엑셀 POI (0) | 2022.11.10 |
JPA Entity > Repository (0) | 2022.09.30 |
JPA Transaction 분리하고 싶을 때 (0) | 2022.04.10 |