/magstudentportal/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/magstudentportal/trunk

« back to all changes in this revision

Viewing changes to src/main/java/db/Course.java

  • Committer: Gustav Hartvigsson
  • Date: 2017-08-17 13:09:18 UTC
  • mto: (15.1.9 magstudentportal-more-db)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: gustav.hartvigsson@gmail.com-20170817130918-sqfpqjdxp0vz1z1t
* fixed indentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import javax.persistence.*;
5
5
import java.util.List;
6
6
 
7
 
 
8
7
/**
9
8
 * The persistent class for the course database table.
10
9
 * 
11
10
 */
12
11
@Entity
13
 
@Table(name="course")
14
 
@NamedQuery(name="Course.findAll", query="SELECT c FROM Course c")
 
12
@Table(name = "course")
 
13
@NamedQuery(name = "Course.findAll", query = "SELECT c FROM Course c")
15
14
public class Course implements Serializable {
16
 
        private static final long serialVersionUID = 1L;
17
 
        private Integer id;
18
 
        private String description;
19
 
        private String name;
20
 
        private List<Lecture> lectures;
21
 
 
22
 
        public Course() {
23
 
        }
24
 
 
25
 
 
26
 
        @Id
27
 
        @GeneratedValue(strategy=GenerationType.AUTO)
28
 
        @Column(unique=true, nullable=false)
29
 
        public Integer getId() {
30
 
                return this.id;
31
 
        }
32
 
 
33
 
        public void setId(Integer id) {
34
 
                this.id = id;
35
 
        }
36
 
 
37
 
 
38
 
        @Column(length=2147483647)
39
 
        public String getDescription() {
40
 
                return this.description;
41
 
        }
42
 
 
43
 
        public void setDescription(String description) {
44
 
                this.description = description;
45
 
        }
46
 
 
47
 
 
48
 
        @Column(length=30)
49
 
        public String getName() {
50
 
                return this.name;
51
 
        }
52
 
 
53
 
        public void setName(String name) {
54
 
                this.name = name;
55
 
        }
56
 
 
57
 
 
58
 
        //bi-directional many-to-one association to Lecture
59
 
        @OneToMany(mappedBy="courseBean")
60
 
        public List<Lecture> getLectures() {
61
 
                return this.lectures;
62
 
        }
63
 
 
64
 
        public void setLectures(List<Lecture> lectures) {
65
 
                this.lectures = lectures;
66
 
        }
67
 
 
68
 
        public Lecture addLecture(Lecture lecture) {
69
 
                getLectures().add(lecture);
70
 
                lecture.setCourseBean(this);
71
 
 
72
 
                return lecture;
73
 
        }
74
 
 
75
 
        public Lecture removeLecture(Lecture lecture) {
76
 
                getLectures().remove(lecture);
77
 
                lecture.setCourseBean(null);
78
 
 
79
 
                return lecture;
80
 
        }
 
15
  private static final long serialVersionUID = 1L;
 
16
  private Integer id;
 
17
  private String description;
 
18
  private String name;
 
19
  private List<Lecture> lectures;
 
20
 
 
21
  public Course() {
 
22
  }
 
23
 
 
24
  @Id
 
25
  @GeneratedValue(strategy = GenerationType.AUTO)
 
26
  @Column(unique = true, nullable = false)
 
27
  public Integer getId() {
 
28
    return this.id;
 
29
  }
 
30
 
 
31
  public void setId(Integer id) {
 
32
    this.id = id;
 
33
  }
 
34
 
 
35
  @Column(length = 2147483647)
 
36
  public String getDescription() {
 
37
    return this.description;
 
38
  }
 
39
 
 
40
  public void setDescription(String description) {
 
41
    this.description = description;
 
42
  }
 
43
 
 
44
  @Column(length = 30)
 
45
  public String getName() {
 
46
    return this.name;
 
47
  }
 
48
 
 
49
  public void setName(String name) {
 
50
    this.name = name;
 
51
  }
 
52
 
 
53
  // bi-directional many-to-one association to Lecture
 
54
  @OneToMany(mappedBy = "courseBean")
 
55
  public List<Lecture> getLectures() {
 
56
    return this.lectures;
 
57
  }
 
58
 
 
59
  public void setLectures(List<Lecture> lectures) {
 
60
    this.lectures = lectures;
 
61
  }
 
62
 
 
63
  public Lecture addLecture(Lecture lecture) {
 
64
    getLectures().add(lecture);
 
65
    lecture.setCourseBean(this);
 
66
 
 
67
    return lecture;
 
68
  }
 
69
 
 
70
  public Lecture removeLecture(Lecture lecture) {
 
71
    getLectures().remove(lecture);
 
72
    lecture.setCourseBean(null);
 
73
 
 
74
    return lecture;
 
75
  }
81
76
 
82
77
}
 
 
b'\\ No newline at end of file'