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