/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
 * vi: set shiftwidth=2 tabstop=2 expandtab:
 * :indentSize=2:tabSize=2:noTabs=true:
 */

package db;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;

/**
 * The persistent class for the student database table.
 * 
 */
@Entity
@Table(name = "student")
@NamedQuery(name = "Student.findAll", query = "SELECT s FROM Student s")
public class Student implements Serializable {
  private static final long serialVersionUID = 1L;
  private Integer id;
  private String class_;
  private String nameFirst;
  private String nameLast;
  private String pwd;
  private String userName;
  private List<StudentAttendance> studentAttendances;

  public Student() {
  }

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(unique = true, nullable = false)
  public Integer getId() {
    return this.id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  @Column(name = "class", length = 32)
  public String getClass_() {
    return this.class_;
  }

  public void setClass_(String class_) {
    this.class_ = class_;
  }

  @Column(name = "name_first", nullable = false, length = 32)
  public String getNameFirst() {
    return this.nameFirst;
  }

  public void setNameFirst(String nameFirst) {
    this.nameFirst = nameFirst;
  }

  @Column(name = "name_last", nullable = false, length = 32)
  public String getNameLast() {
    return this.nameLast;
  }

  public void setNameLast(String nameLast) {
    this.nameLast = nameLast;
  }

  @Column(nullable = false, length = 256)
  public String getPwd() {
    return this.pwd;
  }

  public void setPwd(String pwd) {
    this.pwd = pwd;
  }

  @Column(name = "user_name", nullable = false, length = 32)
  public String getUserName() {
    return this.userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  // bi-directional many-to-one association to StudentAttendance
  @OneToMany(mappedBy = "studentBean")
  public List<StudentAttendance> getStudentAttendances() {
    return this.studentAttendances;
  }

  public void setStudentAttendances(List<StudentAttendance> studentAttendances) {
    this.studentAttendances = studentAttendances;
  }

  public StudentAttendance addStudentAttendance(StudentAttendance studentAttendance) {
    getStudentAttendances().add(studentAttendance);
    studentAttendance.setStudentBean(this);

    return studentAttendance;
  }

  public StudentAttendance removeStudentAttendance(StudentAttendance studentAttendance) {
    getStudentAttendances().remove(studentAttendance);
    studentAttendance.setStudentBean(null);

    return studentAttendance;
  }

}
