Matthias Andreas Benkard | 764e4d1 | 2020-01-12 16:46:13 +0100 | [diff] [blame] | 1 | package eu.mulk.mulkcms2.entity; |
Matthias Andreas Benkard | 2f0b370 | 2020-01-12 15:46:34 +0100 | [diff] [blame] | 2 | |
| 3 | import java.io.Serializable; |
| 4 | import java.util.Objects; |
| 5 | import javax.persistence.Column; |
| 6 | import javax.persistence.Id; |
| 7 | |
| 8 | public class OpenIdPK implements Serializable { |
| 9 | |
| 10 | private int userId; |
| 11 | private String openid; |
| 12 | |
| 13 | @Column(name = "user", nullable = false) |
| 14 | @Id |
| 15 | public int getUserId() { |
| 16 | return userId; |
| 17 | } |
| 18 | |
| 19 | public void setUserId(int userId) { |
| 20 | this.userId = userId; |
| 21 | } |
| 22 | |
| 23 | @Column(name = "openid", nullable = false, length = -1) |
| 24 | @Id |
| 25 | public String getOpenid() { |
| 26 | return openid; |
| 27 | } |
| 28 | |
| 29 | public void setOpenid(String openid) { |
| 30 | this.openid = openid; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public boolean equals(Object o) { |
| 35 | if (this == o) { |
| 36 | return true; |
| 37 | } |
| 38 | if (o == null || getClass() != o.getClass()) { |
| 39 | return false; |
| 40 | } |
| 41 | OpenIdPK openIdPK = (OpenIdPK) o; |
Matthias Andreas Benkard | 571fd85 | 2020-01-12 20:30:21 +0100 | [diff] [blame] | 42 | return userId == openIdPK.userId && Objects.equals(openid, openIdPK.openid); |
Matthias Andreas Benkard | 2f0b370 | 2020-01-12 15:46:34 +0100 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public int hashCode() { |
| 47 | return Objects.hash(userId, openid); |
| 48 | } |
| 49 | } |