-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
92 lines (72 loc) · 2.1 KB
/
Student.java
File metadata and controls
92 lines (72 loc) · 2.1 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package sba.sms.models;
import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.FieldDefaults;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
/**
* Student is a POJO, configured as a persistent class that represents (or maps to) a table
* name 'student' in the database. A Student object contains fields that represent student
* login credentials and a join table containing a registered student's email and course(s)
* data. The Student class can be viewed as the owner of the bi-directional relationship.
* Implement Lombok annotations to eliminate boilerplate code.
*/
@Entity
@Table(name = "Student")
public class Student {
@Id
@Column(name ="email")
private String email;
@Column(name = "name")
private String name;
@Column(name = "password")
private String password;
@ManyToMany(targetEntity = Course.class)
private Set<Course> course;
public Student(){
}
public Student(String email,String name,String password,Set<Course> course){
this.email = email;
this.name = name;
this.password = password;
this.course = course;
}
public Student(String email,String name,String password){
this.email = email;
this.name = name;
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Set<Course> getCourse() {
return course;
}
public void setCourse(Set<Course> course) {
this.course = course;
}
@Override
public String toString() {
return "Student{" +
"email='" + email + '\'' +
", name='" + name + '\'' +
", password='" + password + '\'' +
'}';
}
}