commit | author | age
|
41d500
|
1 |
package com.redhat.training.model; |
RS |
2 |
|
|
3 |
import javax.persistence.Entity; |
|
4 |
import javax.persistence.GeneratedValue; |
|
5 |
import javax.persistence.GenerationType; |
|
6 |
import javax.persistence.Id; |
|
7 |
import javax.persistence.OneToOne; |
|
8 |
|
|
9 |
@Entity |
|
10 |
public class Email { |
|
11 |
|
|
12 |
@Id |
|
13 |
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|
14 |
private Long id; |
|
15 |
|
|
16 |
private String address; |
|
17 |
|
|
18 |
//TODO map relationship |
|
19 |
|
|
20 |
private User user; |
|
21 |
|
|
22 |
public Long getId() { |
|
23 |
return id; |
|
24 |
} |
|
25 |
|
|
26 |
public void setId(Long id) { |
|
27 |
this.id = id; |
|
28 |
} |
|
29 |
|
|
30 |
public User getUser() { |
|
31 |
return user; |
|
32 |
} |
|
33 |
|
|
34 |
public void setUser(User user) { |
|
35 |
this.user = user; |
|
36 |
} |
|
37 |
|
|
38 |
public String getAddress() { |
|
39 |
return address; |
|
40 |
} |
|
41 |
|
|
42 |
public void setAddress(String address) { |
|
43 |
this.address = address; |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public String toString() { |
|
48 |
return "Email [id=" + id + "]"; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public int hashCode() { |
|
53 |
final int prime = 31; |
|
54 |
int result = 1; |
|
55 |
result = prime * result + ((id == null) ? 0 : id.hashCode()); |
|
56 |
return result; |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public boolean equals(Object obj) { |
|
61 |
if (this == obj) |
|
62 |
return true; |
|
63 |
if (obj == null) |
|
64 |
return false; |
|
65 |
if (getClass() != obj.getClass()) |
|
66 |
return false; |
|
67 |
Email other = (Email) obj; |
|
68 |
if (id == null) { |
|
69 |
if (other.id != null) |
|
70 |
return false; |
|
71 |
} else if (!id.equals(other.id)) |
|
72 |
return false; |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
} |