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