blob: b9035f53adcee785f2b5a0fca78a19182ceb7a62 [file] [log] [blame]
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01001package eu.mulk.entity;
2
3import java.io.Serializable;
4import java.util.Arrays;
5import java.util.Objects;
6import javax.persistence.Column;
7import javax.persistence.Id;
8
9public 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}