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