Skip to content

Commit

Permalink
feat:[kakao-tech-campus-2nd-step3#24]- Add LocalDateTime
Browse files Browse the repository at this point in the history
String으로 관리하던 타입을 LocalDateTime으로 변경
  • Loading branch information
yooonwodyd committed Sep 27, 2024
1 parent 6f7a3ab commit c1c0608
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/java/com/helpmeCookies/user/entity/User.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.helpmeCookies.user.entity;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.format.annotation.DateTimeFormat;

import com.helpmeCookies.product.entity.HashTag;

import jakarta.persistence.CollectionTable;
Expand Down Expand Up @@ -47,9 +51,14 @@ public class User {
@Column(nullable = false)
private String address;

@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@CreatedDate
@Column(nullable = false, updatable = false)
protected LocalDateTime createdAt;

// 별도의 테이블 생성. 문자열로 저장
@ElementCollection(targetClass = HashTag.class)
@CollectionTable(name = "user_hashtag")
@CollectionTable(name = "user_hashtags")
@Enumerated(EnumType.STRING)
private List<HashTag> hashTags;
}
private List<HashTag> hashTags; // 기본 FetchType.LAZY
}

0 comments on commit c1c0608

Please sign in to comment.