-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/org/sopt/seminar/domain/member/domain/Member.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.sopt.seminar.domain.member.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import org.sopt.seminar.global.common.BaseTimeEntity; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Builder(access = AccessLevel.PRIVATE) | ||
@DynamicUpdate | ||
@Getter | ||
@Entity | ||
public class Member extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "member_id") | ||
private Long id; | ||
private String name; | ||
private String nickname; | ||
private Integer age; | ||
@Embedded | ||
private Sopt sopt; | ||
|
||
public static Member createMember(final String name, final String nickname, final Integer age, final Sopt sopt) { | ||
return Member.builder() | ||
.name(name) | ||
.nickname(nickname) | ||
.age(age) | ||
.sopt(sopt) | ||
.build(); | ||
} | ||
|
||
public void updateSopt(Sopt sopt) { | ||
this.sopt = sopt; | ||
} | ||
} |