-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrack.java
More file actions
35 lines (27 loc) · 847 Bytes
/
Track.java
File metadata and controls
35 lines (27 loc) · 847 Bytes
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
package com.example.enjoy.entity;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@Entity
@Getter @Setter
public class Track {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String department;
@OneToMany(mappedBy = "track", cascade = CascadeType.ALL)
private List<TrackCourse> courses = new ArrayList<>();
@OneToMany(mappedBy = "track", cascade = CascadeType.ALL)
private List<UserTrack> userTracks = new ArrayList<>();
public void addUserTrack(UserTrack userTrack) {
userTracks.add(userTrack);
userTrack.setTrack(this);
}
// public void addCourse(TrackCourse course) {
// courses.add(course);
// course.setTrack(this);
// }
}