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 EOdId implements Serializable {
|
---|
12 | private static final long serialVersionUID = -2023892387074364524L;
|
---|
13 | @Column(name = "id_knigi", nullable = false)
|
---|
14 | private Integer idKnigi;
|
---|
15 | @Column(name = "id_na_kategorija", nullable = false)
|
---|
16 | private Integer idNaKategorija;
|
---|
17 |
|
---|
18 | public Integer getIdNaKategorija() {
|
---|
19 | return idNaKategorija;
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void setIdNaKategorija(Integer idNaKategorija) {
|
---|
23 | this.idNaKategorija = idNaKategorija;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public Integer getIdKnigi() {
|
---|
27 | return idKnigi;
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void setIdKnigi(Integer idKnigi) {
|
---|
31 | this.idKnigi = idKnigi;
|
---|
32 | }
|
---|
33 |
|
---|
34 | @Override
|
---|
35 | public int hashCode() {
|
---|
36 | return Objects.hash(idNaKategorija, idKnigi);
|
---|
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 | EOdId entity = (EOdId) o;
|
---|
44 | return Objects.equals(this.idNaKategorija, entity.idNaKategorija) &&
|
---|
45 | Objects.equals(this.idKnigi, entity.idKnigi);
|
---|
46 | }
|
---|
47 | } |
---|