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 |
/**
|
|
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 |
}
|