source: src/main/java/com/example/baza/model/InstancaOdKnigaId.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.3 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 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}
Note: See TracBrowser for help on using the repository browser.