/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/Lecture.java

  • Committer: Gustav Hartvigsson
  • Date: 2017-08-28 14:00:50 UTC
  • mfrom: (15.1.3 magstudentportal-more-db)
  • Revision ID: gustav.hartvigsson@gmail.com-20170828140050-zu6nqc1vlp9wnwh8
* derp?

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package DB;
 
2
 
 
3
import java.io.Serializable;
 
4
import javax.persistence.*;
 
5
import java.util.List;
 
6
 
 
7
 
 
8
/**
 
9
 * The persistent class for the lecture database table.
 
10
 * 
 
11
 */
 
12
@Entity
 
13
@Table(name="lecture")
 
14
@NamedQuery(name="Lecture.findAll", query="SELECT l FROM Lecture l")
 
15
public class Lecture implements Serializable {
 
16
        private static final long serialVersionUID = 1L;
 
17
        private LecturePK id;
 
18
        private Course courseBean;
 
19
        private List<StudentAttendance> studentAttendances;
 
20
 
 
21
        public Lecture() {
 
22
        }
 
23
 
 
24
 
 
25
        @EmbeddedId
 
26
        public LecturePK getId() {
 
27
                return this.id;
 
28
        }
 
29
 
 
30
        public void setId(LecturePK id) {
 
31
                this.id = id;
 
32
        }
 
33
 
 
34
 
 
35
        //bi-directional many-to-one association to Course
 
36
        @ManyToOne
 
37
        @JoinColumn(name="course", nullable=false, insertable=false, updatable=false)
 
38
        public Course getCourseBean() {
 
39
                return this.courseBean;
 
40
        }
 
41
 
 
42
        public void setCourseBean(Course courseBean) {
 
43
                this.courseBean = courseBean;
 
44
        }
 
45
 
 
46
 
 
47
        //bi-directional many-to-one association to StudentAttendance
 
48
        @OneToMany(mappedBy="lecture")
 
49
        public List<StudentAttendance> getStudentAttendances() {
 
50
                return this.studentAttendances;
 
51
        }
 
52
 
 
53
        public void setStudentAttendances(List<StudentAttendance> studentAttendances) {
 
54
                this.studentAttendances = studentAttendances;
 
55
        }
 
56
 
 
57
        public StudentAttendance addStudentAttendance(StudentAttendance studentAttendance) {
 
58
                getStudentAttendances().add(studentAttendance);
 
59
                studentAttendance.setLecture(this);
 
60
 
 
61
                return studentAttendance;
 
62
        }
 
63
 
 
64
        public StudentAttendance removeStudentAttendance(StudentAttendance studentAttendance) {
 
65
                getStudentAttendances().remove(studentAttendance);
 
66
                studentAttendance.setLecture(null);
 
67
 
 
68
                return studentAttendance;
 
69
        }
 
70
 
 
71
}
 
 
b'\\ No newline at end of file'