| package eu.mulk.entity; |
| |
| import io.quarkus.hibernate.orm.panache.PanacheEntityBase; |
| import java.util.Arrays; |
| import java.util.Objects; |
| import javax.persistence.Column; |
| import javax.persistence.Entity; |
| import javax.persistence.Id; |
| import javax.persistence.IdClass; |
| import javax.persistence.JoinColumn; |
| import javax.persistence.ManyToOne; |
| import javax.persistence.Table; |
| |
| @Entity |
| @Table(name = "login_certificates", schema = "public", catalog = "mulkcms") |
| @IdClass(LoginCertificatePK.class) |
| public class LoginCertificate extends PanacheEntityBase { |
| |
| private int userId; |
| private byte[] certificate; |
| private User user; |
| |
| @Id |
| @Column(name = "user", nullable = false) |
| public int getUserId() { |
| return userId; |
| } |
| |
| public void setUserId(int userId) { |
| this.userId = userId; |
| } |
| |
| @Id |
| @Column(name = "certificate", nullable = false) |
| public byte[] getCertificate() { |
| return certificate; |
| } |
| |
| public void setCertificate(byte[] certificate) { |
| this.certificate = certificate; |
| } |
| |
| @Override |
| public boolean equals(Object o) { |
| if (this == o) { |
| return true; |
| } |
| if (o == null || getClass() != o.getClass()) { |
| return false; |
| } |
| LoginCertificate that = (LoginCertificate) o; |
| return userId == that.userId && |
| Arrays.equals(certificate, that.certificate); |
| } |
| |
| @Override |
| public int hashCode() { |
| int result = Objects.hash(userId); |
| result = 31 * result + Arrays.hashCode(certificate); |
| return result; |
| } |
| |
| @ManyToOne |
| @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) |
| public User getUser() { |
| return user; |
| } |
| |
| public void setUser(User user) { |
| this.user = user; |
| } |
| } |