[TiStory] User 엔터티 생성 및 더미 데이터 생성

yuzu sim's avatar
Sep 11, 2024
[TiStory] User 엔터티 생성 및 더미 데이터 생성

1. 테이블 생성 및 콘솔창 확인

package site.metacoding.blogv3.user; import jakarta.persistence.*; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.CreationTimestamp; import java.time.LocalDateTime; @Entity @NoArgsConstructor @Data @Table(name = "user_tb") public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String username; private String password; private String email; // private Boolean emailConfirm; //이메일 인증 여부 @CreationTimestamp private LocalDateTime createdAt; @Builder public User(Integer id, String username, String password, String email, LocalDateTime createdAt) { this.id = id; this.username = username; this.password = password; this.email = email; this.createdAt = createdAt; } }
notion image
 

나머지도 확인

notion image
 

2. 더미 데이터 생성 및 확인

-- 유저 더미 INSERT INTO user_tb (username, password, email, created_at) VALUES ('ssar12', 'zheld8282@', 'ssar@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('cos', '1234', 'cos@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('love', '1234', 'love@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('vivi', '1234', 'vivi@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('cindy', '1234', 'cindy@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('mango', '1234', 'mango@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('kia12', '1234', 'kia12@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('dragon', '1234', 'dragon@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('haha', '1234', 'haha@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('soso', '1234', 'soso@nate.com', now()); INSERT INTO user_tb (username, password, email, created_at) VALUES ('code5', 'dirn111dnl@', 'codingstory2@gmail.com', now());
notion image
 
 
Share article

Coding_study