전체 글(63)
-
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 -
Spring Boot + Thymeleaf Tag JAVA CUSTOM UTIL 사용
@Component public class CustomUtils { public static String removeTag(String html) throws Exception { return html.replaceAll("]*)?(\\s)*(/)?>", ""); } } 자바 Class 에 Component 추가 후 Thymeleaf 에서 이런 식으로 사용할 수 있다.
2023.06.27