-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
88 lines (71 loc) · 2.03 KB
/
Course.java
File metadata and controls
88 lines (71 loc) · 2.03 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
package sba.sms.models;
import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.FieldDefaults;
import sba.sms.dao.CourseI;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
/**
* Course is a POJO, configured as a persistent class that represents (or maps to) a table
* name 'course' in the database. A Course object contains fields that represent course
* information and a mapping of 'courses' that indicate an inverse or referencing side
* of the relationship. Implement Lombok annotations to eliminate boilerplate code.
*/
@Entity
@Table(name = "Course")
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name ="id")
private int id;
@Column(name = "name")
private String name;
@Column(name = "instructor")
private String instructor;
@ManyToMany(targetEntity = Student.class)
private Set<Student> students;
public Course(){
}
public Course(String name, String instructor, Set<Student> students) {
this.name = name;
this.instructor = instructor;
this.students = students;
}
public Course(String name, String instructor) {
this.name = name;
this.instructor = instructor;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getInstructor() {
return instructor;
}
public void setInstructor(String instructor) {
this.instructor = instructor;
}
public Set<Student> getStudents() {
return students;
}
public void setStudents(Set<Student> students) {
this.students = students;
}
@Override
public String toString() {
return "Course{" +
"id=" + id +
", name='" + name + '\'' +
", instructor='" + instructor + '\'' +
'}';
}
}