bzr branch
http://gegoxaren.bato24.eu/bzr/magstudentportal/trunk
18
by Gustav Hartvigsson
* Added vim modelines |
1 |
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
|
2 |
* vi: set shiftwidth=2 tabstop=2 expandtab:
|
|
3 |
* :indentSize=2:tabSize=2:noTabs=true:
|
|
4 |
*/
|
|
5 |
||
15.1.3
by Gustav Hartvigsson
Generated classes from tables and added them. |
6 |
package DB; |
7 |
||
8 |
import java.io.Serializable; |
|
9 |
import javax.persistence.*; |
|
10 |
import java.util.List; |
|
11 |
||
12 |
/**
|
|
13 |
* The persistent class for the lecture database table.
|
|
14 |
*
|
|
15 |
*/
|
|
16 |
@Entity
|
|
15.1.6
by Gustav Hartvigsson
* tabs -> 2 spaces |
17 |
@Table(name = "lecture") |
18 |
@NamedQuery(name = "Lecture.findAll", query = "SELECT l FROM Lecture l") |
|
15.1.3
by Gustav Hartvigsson
Generated classes from tables and added them. |
19 |
public class Lecture implements Serializable { |
15.1.6
by Gustav Hartvigsson
* tabs -> 2 spaces |
20 |
private static final long serialVersionUID = 1L; |
21 |
private LecturePK id; |
|
22 |
private Course courseBean; |
|
23 |
private List<StudentAttendance> studentAttendances; |
|
24 |
||
25 |
public Lecture() { |
|
26 |
} |
|
27 |
||
28 |
@EmbeddedId |
|
29 |
public LecturePK getId() { |
|
30 |
return this.id; |
|
31 |
} |
|
32 |
||
33 |
public void setId(LecturePK id) { |
|
34 |
this.id = id; |
|
35 |
} |
|
36 |
||
37 |
// bi-directional many-to-one association to Course |
|
38 |
@ManyToOne |
|
39 |
@JoinColumn(name = "course", nullable = false, insertable = false, updatable = false) |
|
40 |
public Course getCourseBean() { |
|
41 |
return this.courseBean; |
|
42 |
} |
|
43 |
||
44 |
public void setCourseBean(Course courseBean) { |
|
45 |
this.courseBean = courseBean; |
|
46 |
} |
|
47 |
||
48 |
// bi-directional many-to-one association to StudentAttendance |
|
49 |
@OneToMany(mappedBy = "lecture") |
|
50 |
public List<StudentAttendance> getStudentAttendances() { |
|
51 |
return this.studentAttendances; |
|
52 |
} |
|
53 |
||
54 |
public void setStudentAttendances(List<StudentAttendance> studentAttendances) { |
|
55 |
this.studentAttendances = studentAttendances; |
|
56 |
} |
|
57 |
||
58 |
public StudentAttendance addStudentAttendance(StudentAttendance studentAttendance) { |
|
59 |
getStudentAttendances().add(studentAttendance); |
|
60 |
studentAttendance.setLecture(this); |
|
61 |
||
62 |
return studentAttendance; |
|
63 |
} |
|
64 |
||
65 |
public StudentAttendance removeStudentAttendance(StudentAttendance studentAttendance) { |
|
66 |
getStudentAttendances().remove(studentAttendance); |
|
67 |
studentAttendance.setLecture(null); |
|
68 |
||
69 |
return studentAttendance; |
|
70 |
} |
|
15.1.3
by Gustav Hartvigsson
Generated classes from tables and added them. |
71 |
|
72 |
}
|