/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 student database table.
14
 * 
15
 */
6.1.1 by Gustav Hartvigsson
Started work on the DB/JPA stuffs
16
@Entity
15.1.6 by Gustav Hartvigsson
* tabs -> 2 spaces
17
@Table(name = "student")
18
@NamedQuery(name = "Student.findAll", query = "SELECT s FROM Student s")
6.1.1 by Gustav Hartvigsson
Started work on the DB/JPA stuffs
19
public class Student implements Serializable {
15.1.6 by Gustav Hartvigsson
* tabs -> 2 spaces
20
  private static final long serialVersionUID = 1L;
21
  private Integer id;
22
  private String class_;
23
  private String nameFirst;
24
  private String nameLast;
25
  private String pwd;
26
  private String userName;
27
  private List<StudentAttendance> studentAttendances;
28
29
  public Student() {
30
  }
31
32
  @Id
33
  @GeneratedValue(strategy = GenerationType.AUTO)
34
  @Column(unique = true, nullable = false)
35
  public Integer getId() {
36
    return this.id;
37
  }
38
39
  public void setId(Integer id) {
40
    this.id = id;
41
  }
42
43
  @Column(name = "class", length = 32)
44
  public String getClass_() {
45
    return this.class_;
46
  }
47
48
  public void setClass_(String class_) {
49
    this.class_ = class_;
50
  }
51
52
  @Column(name = "name_first", nullable = false, length = 32)
53
  public String getNameFirst() {
54
    return this.nameFirst;
55
  }
56
57
  public void setNameFirst(String nameFirst) {
58
    this.nameFirst = nameFirst;
59
  }
60
61
  @Column(name = "name_last", nullable = false, length = 32)
62
  public String getNameLast() {
63
    return this.nameLast;
64
  }
65
66
  public void setNameLast(String nameLast) {
67
    this.nameLast = nameLast;
68
  }
69
70
  @Column(nullable = false, length = 256)
71
  public String getPwd() {
72
    return this.pwd;
73
  }
74
75
  public void setPwd(String pwd) {
76
    this.pwd = pwd;
77
  }
78
79
  @Column(name = "user_name", nullable = false, length = 32)
80
  public String getUserName() {
81
    return this.userName;
82
  }
83
84
  public void setUserName(String userName) {
85
    this.userName = userName;
86
  }
87
88
  // bi-directional many-to-one association to StudentAttendance
89
  @OneToMany(mappedBy = "studentBean")
90
  public List<StudentAttendance> getStudentAttendances() {
91
    return this.studentAttendances;
92
  }
93
94
  public void setStudentAttendances(List<StudentAttendance> studentAttendances) {
95
    this.studentAttendances = studentAttendances;
96
  }
97
98
  public StudentAttendance addStudentAttendance(StudentAttendance studentAttendance) {
99
    getStudentAttendances().add(studentAttendance);
100
    studentAttendance.setStudentBean(this);
101
102
    return studentAttendance;
103
  }
104
105
  public StudentAttendance removeStudentAttendance(StudentAttendance studentAttendance) {
106
    getStudentAttendances().remove(studentAttendance);
107
    studentAttendance.setStudentBean(null);
108
109
    return studentAttendance;
110
  }
15.1.3 by Gustav Hartvigsson
Generated classes from tables and added them.
111
27 by Gustav Hartvigsson
* changed DB -> db
112
}