티스토리 뷰
Date 타임을 표기할때 각 프로젝트 마다 원하는 표기 방법이 다르다.
JPA에서는 @Temporal annotation을 줌으로써 구별한다.
@Temporal(TemporalType.DATE)
Date regDate;
@Temporal(TemporalType.TIME)
Date regTime;
@Temporal(TemporalType.TIMESTAMP)
Date regTimestamp;
TemporalType.Date : 년-월-일 의 date 타입
TemporalType.Time : 시:분:초 의 time 타입
TemporalType.TIMESTAMP : date + time 의 timestamp(datetime) 타입
annotation을 사용하지 않으면 timestamp가 기본값이 된다.
'Spring boot > JPA' 카테고리의 다른 글
10. JPA - intellij Q class path 찾지 못할때 (0) | 2022.10.30 |
---|---|
08. JPA - QueryDsl 기본 사용 방법 (0) | 2022.01.27 |
07. JPA - QueryDsl 환경설정 (0) | 2022.01.27 |
06. JPA - @Temporal annotation (0) | 2021.11.16 |
05. JPA - Pageable을 통한 페이징 처리 (0) | 2021.06.15 |
댓글