웹개발/JPA(2)
-
Spring Boot + JPA 작성일자 자동 수정 방지
@CreationTimestamp @Column(updatable=false) private LocalDateTime createAt; // 작성일자 updatable = false 를 사용 하면 Entity가 Update 될때 변경되지 않는다.
2023.06.29 -
SpringBoot + JPA 조인테이블 직접 설정 및 정렬 컬럼 추가
// 강좌 와 시리즈 조인 테이블 @Data @Entity @Builder @AllArgsConstructor @NoArgsConstructor public class LectureSeriesLecture{ @Id private Long id; @ManyToOne @JoinColumn(name="lectureSeriesId") private LectureSeries lectureSeries; @ManyToOne @JoinColumn(name="lectureId") private Lecture lecture; private Long orderNum; } 위 테이블은 생성되는 조인테이블을 대체할 Entity 이다 // 강좌 시리즈 테이블 @Data @Entity @EqualsAndHashCode(of = "..
2023.06.28