commit | author | age
|
aaf094
|
1 |
package com.redhat.training.model; |
RS |
2 |
//add required libraries |
|
3 |
|
|
4 |
//add @Entity annotation here |
|
5 |
public class Person { |
|
6 |
|
|
7 |
//add annotations for primary key |
|
8 |
private Long id; |
|
9 |
|
|
10 |
//add @Column(name="name") annotation to map column in database table |
|
11 |
private String personName; |
|
12 |
|
|
13 |
public Long getId() { |
|
14 |
return id; |
|
15 |
} |
|
16 |
|
|
17 |
public void setId(Long id) { |
|
18 |
this.id = id; |
|
19 |
} |
|
20 |
|
|
21 |
public String getPersonName() { |
|
22 |
return personName; |
|
23 |
} |
|
24 |
|
|
25 |
public void setName(String personName) { |
|
26 |
this.personName = personName; |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public int hashCode() { |
|
31 |
final int prime = 31; |
|
32 |
int result = 1; |
|
33 |
result = prime * result + ((id == null) ? 0 : id.hashCode()); |
|
34 |
return result; |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public boolean equals(Object obj) { |
|
39 |
if (this == obj) |
|
40 |
return true; |
|
41 |
if (obj == null) |
|
42 |
return false; |
|
43 |
if (getClass() != obj.getClass()) |
|
44 |
return false; |
|
45 |
Person other = (Person) obj; |
|
46 |
if (id == null) { |
|
47 |
if (other.id != null) |
|
48 |
return false; |
|
49 |
} else if (!id.equals(other.id)) |
|
50 |
return false; |
|
51 |
return true; |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
} |