source: src/main/java/com/example/eatys_app/model/CenaId.java

Last change on this file was b3f2adb, checked in by Aleksandar Siljanoski <acewow3@…>, 14 months ago

Adding project to repo

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[b3f2adb]1package com.example.eatys_app.model;
2
3import jakarta.persistence.*;
4import org.hibernate.Hibernate;
5
6import java.io.Serializable;
7import java.util.Objects;
8
9@Embeddable
10public class CenaId implements Serializable {
11
12 @MapsId("ObrokId")
13 @ManyToOne
14 @JoinColumn(name = "obrok_id", nullable = false)
15 private Obrok ObrokId;
16
17 @GeneratedValue(strategy = GenerationType.IDENTITY)
18 @Column(name = "cena_id")
19 private Integer CenaId;
20
21 public CenaId() {
22 }
23
24 public CenaId(Obrok ObrokId, Integer CenaId) {
25 this.ObrokId = ObrokId;
26 this.CenaId = CenaId;
27 }
28
29 public Obrok getObrokId() {
30 return ObrokId;
31 }
32
33 public void setObrokId(Obrok ObrokId) {
34 this.ObrokId = ObrokId;
35 }
36
37 public Integer getCenaId() {
38 return CenaId;
39 }
40
41 public void setCenaId(Integer CenaId) {
42 this.CenaId = CenaId;
43 }
44
45 @Override
46 public boolean equals(Object o) {
47 if (this == o) return true;
48 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
49 CenaId entity = (CenaId) o;
50 return Objects.equals(this.ObrokId, entity.ObrokId) &&
51 Objects.equals(this.CenaId, entity.CenaId);
52 }
53
54 @Override
55 public int hashCode() {
56 return Objects.hash(ObrokId, CenaId);
57 }
58}
59
Note: See TracBrowser for help on using the repository browser.