Advertisement
Guest User

Student.java

a guest
May 27th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. package it.unibo.tw.hibernate;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Date;
  5.  
  6. public class Student implements Serializable {
  7.  
  8. private static final long serialVersionUID = 1L;
  9.  
  10.  
  11. // ---------------------------
  12.  
  13. private int id;
  14. private String firstName;
  15. private String lastName;
  16. private Date birthDate;
  17.  
  18.  
  19. // --- constructor ----------
  20.  
  21. public Student() {
  22. }
  23.  
  24.  
  25. // --- getters and setters --------------
  26.  
  27. public int getId() {
  28. return id;
  29. }
  30.  
  31. public void setId(int id) {
  32. this.id = id;
  33. }
  34.  
  35. public String getFirstName() {
  36. return firstName;
  37. }
  38.  
  39. public void setFirstName(String firstName) {
  40. this.firstName = firstName;
  41. }
  42.  
  43. public String getLastName() {
  44. return lastName;
  45. }
  46.  
  47. public void setLastName(String lastName) {
  48. this.lastName = lastName;
  49. }
  50.  
  51. public Date getBirthDate() {
  52. return birthDate;
  53. }
  54.  
  55. public void setBirthDate(Date birthDate) {
  56. this.birthDate = birthDate;
  57. }
  58.  
  59.  
  60.  
  61. // --- utilities ----------------------------
  62.  
  63. @Override
  64. public int hashCode() {
  65. final int prime = 31;
  66. int result = 1;
  67. result = prime * result + id;
  68. return result;
  69. }
  70.  
  71.  
  72. @Override
  73. public boolean equals(Object obj) {
  74. if (this == obj)
  75. return true;
  76. if (obj == null)
  77. return false;
  78. if (getClass() != obj.getClass())
  79. return false;
  80. Student other = (Student) obj;
  81. if (id != other.id)
  82. return false;
  83. return true;
  84. }
  85.  
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement