From 6423c504e66e51f715e793617e86cab86cfff6b4 Mon Sep 17 00:00:00 2001 From: Geonhee Min Date: Fri, 31 Oct 2025 07:26:17 +0000 Subject: [PATCH] =?UTF-8?q?issue=20#=20ExampleEntity=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/entity/ExampleEntity.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/baekyangdan/scheduler/entity/ExampleEntity.java b/src/main/java/com/baekyangdan/scheduler/entity/ExampleEntity.java index 3e55136..d4d313f 100644 --- a/src/main/java/com/baekyangdan/scheduler/entity/ExampleEntity.java +++ b/src/main/java/com/baekyangdan/scheduler/entity/ExampleEntity.java @@ -1,28 +1,41 @@ +import jakarta.persistence.*; import lombok.*; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; +import java.time.LocalDateTime; +import java.util.UUID; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor(access = AccessLevel.PRIVATE) @Builder @Entity -@TABLE(name = "example") -public class Example { +@Table( + name = "users", + indexes = @Index(name = "idx_users_email", columnList = "email") +) +public class User { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private String id; + @GeneratedValue + @org.hibernate.annotations.UuidGenerator + private UUID id; - @Column(nullable = true, length = 50) - private String username; + @Column(nullable = false, length = 50) + private String userName; + + @Column(nullable = false, unique = true, length = 100) + private String email; - @Builder.Default @Column(nullable = false) - private Boolean isDeleted = false; + private Boolean active; + + @Enumerated(EnumType.STRING) + private Role role; @CreationTimestamp private LocalDateTime createdAt; - public void delete() { - this.isDeleted = true; - } + @UpdateTimestamp + private LocalDateTime updatedAt; } \ No newline at end of file