|
| 1 | +package ru.javacourse.model; |
| 2 | + |
| 3 | + |
| 4 | +import javax.persistence.*; |
| 5 | +import java.util.ArrayList; |
| 6 | +import java.util.HashSet; |
| 7 | +import java.util.List; |
| 8 | + |
| 9 | +@Entity |
| 10 | +@Table(name = "lesson") |
| 11 | +public class Lesson { |
| 12 | + |
| 13 | + @Id |
| 14 | + @Column(name = "lesson_id") |
| 15 | + private Integer lessonId; |
| 16 | + |
| 17 | + @Column(name = "chapter") |
| 18 | + private String chapter; |
| 19 | + |
| 20 | + @Column(name = "title") |
| 21 | + private String title; |
| 22 | + |
| 23 | + @Column(name = "description") |
| 24 | + private String description; |
| 25 | + |
| 26 | + @Column(name = "resource_id") |
| 27 | + private Integer resourceId; |
| 28 | + |
| 29 | + @OneToMany(mappedBy = "lesson", fetch = FetchType.EAGER) |
| 30 | + private List<LessonTask> lessonTasks; |
| 31 | + |
| 32 | + @OneToMany(mappedBy = "resourceId", fetch = FetchType.EAGER) |
| 33 | + private List<Resource> resources; |
| 34 | + |
| 35 | + public Integer getLessonId() { |
| 36 | + return lessonId; |
| 37 | + } |
| 38 | + |
| 39 | + public void setLessonId(Integer lessonId) { |
| 40 | + this.lessonId = lessonId; |
| 41 | + } |
| 42 | + |
| 43 | + public String getChapter() { |
| 44 | + return chapter; |
| 45 | + } |
| 46 | + |
| 47 | + public void setChapter(String chapter) { |
| 48 | + this.chapter = chapter; |
| 49 | + } |
| 50 | + |
| 51 | + public String getTitle() { |
| 52 | + return title; |
| 53 | + } |
| 54 | + |
| 55 | + public void setTitle(String title) { |
| 56 | + this.title = title; |
| 57 | + } |
| 58 | + |
| 59 | + public String getDescription() { |
| 60 | + return description; |
| 61 | + } |
| 62 | + |
| 63 | + public void setDescription(String description) { |
| 64 | + this.description = description; |
| 65 | + } |
| 66 | + |
| 67 | + public Integer getResourceId() { |
| 68 | + return resourceId; |
| 69 | + } |
| 70 | + |
| 71 | + public void setResourceId(Integer resourceId) { |
| 72 | + this.resourceId = resourceId; |
| 73 | + } |
| 74 | + |
| 75 | + |
| 76 | + @Override |
| 77 | + public String toString() { |
| 78 | + return "Lesson{" + |
| 79 | + "lessonId=" + lessonId + |
| 80 | + ", chapter='" + chapter + '\'' + |
| 81 | + ", title='" + title + '\'' + |
| 82 | + ", description='" + description + '\'' + |
| 83 | + ", resourceId=" + resourceId + |
| 84 | + '}'; |
| 85 | + } |
| 86 | + |
| 87 | +} |
0 commit comments