Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package entities;
- import java.io.Serializable;
- import java.util.List;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- import javax.persistence.JoinColumn;
- import javax.persistence.ManyToOne;
- import javax.persistence.NamedQueries;
- import javax.persistence.NamedQuery;
- import javax.persistence.Table;
- import javax.validation.constraints.NotNull;
- import javax.validation.constraints.Pattern;
- /**
- *
- * @author emanuelx
- */
- @NamedQueries({
- @NamedQuery(name = "getAllStudents",
- query = "SELECT s FROM Student s order by s.name"),})
- @Entity
- @Table(name="STUDENTS")
- public class Student implements Serializable {
- @Id
- @NotNull
- private String username;
- @NotNull
- private String password;
- @NotNull
- private String name;
- @Pattern(regexp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\."
- + "[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"
- + "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",
- message = "{invalid.email}")
- @NotNull
- private String email;
- @ManyToOne
- @JoinColumn(name="COURSE_CODE")
- @NotNull
- private Course course;
- public Student() {
- }
- public Student(String username, String password, String name, String email, Course course) {
- this.username = username;
- this.password = password;
- this.name = name;
- this.email = email;
- this.course = course;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public Course getCourse() {
- return course;
- }
- public void setCourse(Course course) {
- this.course = course;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement