source: src/main/java/com/example/baza/model/IzdavaId.java@ bc39b15

Last change on this file since bc39b15 was ed20c2c, checked in by HumaSejdini <humasejdini12@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.example.baza.model;
2
3import org.hibernate.Hibernate;
4
5import javax.persistence.Column;
6import javax.persistence.Embeddable;
7import java.io.Serializable;
8import java.util.Objects;
9
10@Embeddable
11public class IzdavaId implements Serializable {
12 private static final long serialVersionUID = 3804192735403669550L;
13 @Column(name = "id_knigi", nullable = false)
14 private Integer idKnigi;
15 @Column(name = "id_avtor", nullable = false)
16 private Integer idAvtor;
17
18 public Integer getIdAvtor() {
19 return idAvtor;
20 }
21
22 public void setIdAvtor(Integer idAvtor) {
23 this.idAvtor = idAvtor;
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(idAvtor, 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 IzdavaId entity = (IzdavaId) o;
44 return Objects.equals(this.idAvtor, entity.idAvtor) &&
45 Objects.equals(this.idKnigi, entity.idKnigi);
46 }
47}
Note: See TracBrowser for help on using the repository browser.