package com.project.beautycenter.model; import org.hibernate.Hibernate; import javax.persistence.Column; import javax.persistence.Embeddable; import java.io.Serializable; import java.util.Objects; @Embeddable public class VraboteniUslugiId implements Serializable { private static final long serialVersionUID = -3435307854722955503L; @Column(name = "user_id_vraboten", nullable = false) private Integer userIdVraboten; @Column(name = "usluga_id", nullable = false, length = 100) private String uslugaId; public String getUslugaId() { return uslugaId; } public void setUslugaId(String uslugaId) { this.uslugaId = uslugaId; } public Integer getUserIdVraboten() { return userIdVraboten; } public void setUserIdVraboten(Integer userIdVraboten) { this.userIdVraboten = userIdVraboten; } public VraboteniUslugiId(Integer userIdVraboten, String uslugaId) { this.userIdVraboten = userIdVraboten; this.uslugaId = uslugaId; } public VraboteniUslugiId(){} @Override public int hashCode() { return Objects.hash(uslugaId, userIdVraboten); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; VraboteniUslugiId entity = (VraboteniUslugiId) o; return Objects.equals(this.uslugaId, entity.uslugaId) && Objects.equals(this.userIdVraboten, entity.userIdVraboten); } }