/magstudentportal/trunk

To get this branch, use:
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
27 by Gustav Hartvigsson
* changed DB -> db
6
package db;
6.1.1 by Gustav Hartvigsson
Started work on the DB/JPA stuffs
7
8
import java.io.Serializable;
15.1.3 by Gustav Hartvigsson
Generated classes from tables and added them.
9
import javax.persistence.*;
10
import java.util.List;
11
12
/**
13
 * The persistent class for the course database table.
14
 * 
15
 */
6.1.1 by Gustav Hartvigsson
Started work on the DB/JPA stuffs
16
@Entity
15.1.5 by Gustav Hartvigsson
* fixed indentation
17
@Table(name = "course")
18
@NamedQuery(name = "Course.findAll", query = "SELECT c FROM Course c")
6.1.1 by Gustav Hartvigsson
Started work on the DB/JPA stuffs
19
public class Course implements Serializable {
15.1.5 by Gustav Hartvigsson
* fixed indentation
20
  private static final long serialVersionUID = 1L;
21
  private Integer id;
22
  private String description;
23
  private String name;
24
  private List<Lecture> lectures;
25
26
  public Course() {
27
  }
28
29
  @Id
30
  @GeneratedValue(strategy = GenerationType.AUTO)
31
  @Column(unique = true, nullable = false)
32
  public Integer getId() {
33
    return this.id;
34
  }
35
36
  public void setId(Integer id) {
37
    this.id = id;
38
  }
39
40
  @Column(length = 2147483647)
41
  public String getDescription() {
42
    return this.description;
43
  }
44
45
  public void setDescription(String description) {
46
    this.description = description;
47
  }
48
49
  @Column(length = 30)
50
  public String getName() {
51
    return this.name;
52
  }
53
54
  public void setName(String name) {
55
    this.name = name;
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.1.3 by Gustav Hartvigsson
Generated classes from tables and added them.
81
27 by Gustav Hartvigsson
* changed DB -> db
82
}