@MappedSuperclass
- 객체의 입장에서 공통 매핑 정보가 필요할 때 사용한다.
- 부모클래스를 의미한다.
- 엔티티는 아니다.
- 공통되는 변수(컬럼)을 빼주기 위한 클래스이다.
- @MappedSuperClass로 지정해준 클래스를 상속받는 엔티티 클래스는, 상속받는 부모 클래스의 멤버변수를 컬럼으로 받는다.
@EntityListeners(AuditingEntitiyListener.class)
- 해당 클래스에 Auditing 기능을 추가하는 것이다.
- 컬럼의 값이 변경됨을 감지합니다.
JPA Auditing과 createAt등의 자세한 내용은 요기
https://thalals.tistory.com/220?category=516795
[Spring] JPA Auditting 과 TimeStamp Class (테이블 시간 기
Spring이든 뭐든 프로젝트를 하다보면, 테이블의 생성기간과, 수정시간이 필요할 때가 있다. 오늘은 이 테이블에 생성, 수정시간을 기록할 수 있는 컬럼을 효율적으로 작성하는 법에 대해 공부해
thalals.tistory.com
*참고
Mappedsuperclass - https://ict-nroo.tistory.com/129
entitylistener, auditing - https://velog.io/@yeon/JPA-Auditing%EA%B3%BC-MappedSuperclass
'Spring > Spring Boot' 카테고리의 다른 글
[Spring] JPA FindAll<Entity> to convert DTO (ModelMapper) (0) | 2021.12.03 |
---|---|
[Spring] JPA 매핑 연관관계 - 게시글에 댓글 달기 (0) | 2021.12.03 |
@NoArgsConstructor 과 @RequiredArgsConstructor (0) | 2021.11.25 |
@RequestBody - ajax Json 요청을 객체 응답으로 자동 변환 (0) | 2021.11.24 |
[@RequestParam Vs @PathVariable] - Spring URL 파라미터 값 받아오기 (0) | 2021.11.23 |