1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.in2.simpleBoard.model;
18
19 import java.io.Serializable;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.GenerationType;
24 import javax.persistence.Id;
25 import javax.persistence.NamedQueries;
26 import javax.persistence.Table;
27
28 @Entity
29 @Table(name = "person")
30 @NamedQueries( {})
31 public class Person implements Serializable {
32 private static final long serialVersionUID = 1L;
33 @Id
34 @Column(name = "id", nullable = false)
35 private Long id;
36
37 @Column(name = "userName", nullable = false)
38 private String userName;
39
40 @Column(name = "password", nullable = false)
41 private String password;
42
43 @Column(name = "name", nullable = false)
44 private String name;
45
46 @Column(name = "surname", nullable = false)
47 private String surname;
48
49 @Column(name = "email", nullable = false)
50 private String email;
51
52 @Column(name = "age", nullable = false)
53 private int age;
54
55 public Person() {
56 }
57
58 public Person(Long id) {
59 this.id = id;
60 }
61
62 public Person(Long id, String userName, String password, String name,
63 String surname, String email, int age) {
64 this.id = id;
65 this.userName = userName;
66 this.password = password;
67 this.name = name;
68 this.surname = surname;
69 this.email = email;
70 this.age = age;
71 }
72
73 @Id
74 @GeneratedValue(strategy = GenerationType.AUTO)
75 public Long getId() {
76 return id;
77 }
78
79 public void setId(Long id) {
80 this.id = id;
81 }
82
83 public String getUserName() {
84 return userName;
85 }
86
87 public void setUserName(String userName) {
88 this.userName = userName;
89 }
90
91 public String getPassword() {
92 return password;
93 }
94
95 public void setPassword(String password) {
96 this.password = password;
97 }
98
99 public String getName() {
100 return name;
101 }
102
103 public void setName(String name) {
104 this.name = name;
105 }
106
107 public String getSurname() {
108 return surname;
109 }
110
111 public void setSurname(String surname) {
112 this.surname = surname;
113 }
114
115 public String getEmail() {
116 return email;
117 }
118
119 public void setEmail(String email) {
120 this.email = email;
121 }
122
123 public int getAge() {
124 return age;
125 }
126
127 public void setAge(int age) {
128 this.age = age;
129 }
130
131 @Override
132 public int hashCode() {
133 int hash = 0;
134 hash += (id != null ? id.hashCode() : 0);
135 return hash;
136 }
137
138 @Override
139 public boolean equals(Object object) {
140
141
142 if (!(object instanceof Person)) {
143 return false;
144 }
145 Person other = (Person) object;
146 if ((this.id == null && other.id != null)
147 || (this.id != null && !this.id.equals(other.id))) {
148 return false;
149 }
150 return true;
151 }
152
153 @Override
154 public String toString() {
155 return "org.in2.simpleBoard.Person[id=" + id + "]";
156 }
157
158 }