-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathCustomer.java
More file actions
50 lines (40 loc) · 1.2 KB
/
Customer.java
File metadata and controls
50 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.programmers.springbootjpa.domain;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@Column(name = "name", nullable = false, length = 20)
private String name;
@Column(name = "age", nullable = false)
private Integer age;
@Column(name = "nick_name", nullable = false)
private String nickName;
@Embedded
private Address address;
@Builder
public Customer(String name, Integer age, String nickName, Address address) {
this.name = name;
this.age = age;
this.nickName = nickName;
this.address = address;
}
public void changeNickName(String nickName) {
this.nickName = nickName;
}
public void changeAddress(Address address) {
this.address = address;
}
}