[ed20c2c] | 1 | package com.example.baza.model;
|
---|
| 2 |
|
---|
| 3 | import org.hibernate.Hibernate;
|
---|
| 4 |
|
---|
| 5 | import javax.persistence.Column;
|
---|
| 6 | import javax.persistence.Embeddable;
|
---|
| 7 | import java.io.Serializable;
|
---|
| 8 | import java.util.Objects;
|
---|
| 9 |
|
---|
| 10 | @Embeddable
|
---|
| 11 | public class InstancaOdKnigaId implements Serializable {
|
---|
| 12 | private static final long serialVersionUID = -8279685280812568305L;
|
---|
| 13 | @Column(name = "id_na_kniga", nullable = false)
|
---|
| 14 | private Integer idNaKniga;
|
---|
| 15 | @Column(name = "unique_id", nullable = false)
|
---|
| 16 | private Integer uniqueId;
|
---|
| 17 |
|
---|
| 18 | public Integer getUniqueId() {
|
---|
| 19 | return uniqueId;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public void setUniqueId(Integer uniqueId) {
|
---|
| 23 | this.uniqueId = uniqueId;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public Integer getIdNaKniga() {
|
---|
| 27 | return idNaKniga;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public void setIdNaKniga(Integer idNaKniga) {
|
---|
| 31 | this.idNaKniga = idNaKniga;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | @Override
|
---|
| 35 | public int hashCode() {
|
---|
| 36 | return Objects.hash(idNaKniga, uniqueId);
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | @Override
|
---|
| 40 | public boolean equals(Object o) {
|
---|
| 41 | if (this == o) return true;
|
---|
| 42 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 43 | InstancaOdKnigaId entity = (InstancaOdKnigaId) o;
|
---|
| 44 | return Objects.equals(this.idNaKniga, entity.idNaKniga) &&
|
---|
| 45 | Objects.equals(this.uniqueId, entity.uniqueId);
|
---|
| 46 | }
|
---|
| 47 | } |
---|