source: src/main/java/mk/ukim/finki/busngo/model/Patnik.java@ 24c39f9

Last change on this file since 24c39f9 was 24c39f9, checked in by ppaunovski <paunovskipavel@…>, 6 months ago

initial classes, no inheritance yet

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package mk.ukim.finki.busngo.model;
2
3import jakarta.persistence.*;
4
5import java.util.Objects;
6
7@Entity
8public class Patnik {
9 private Long kId;
10 private Korisnik korisnikByKId;
11
12 @GeneratedValue(strategy = GenerationType.IDENTITY)
13 @Id
14 @Column(name = "k_id", nullable = false)
15 public Long getkId() {
16 return kId;
17 }
18
19 public void setkId(Long kId) {
20 this.kId = kId;
21 }
22
23 @Override
24 public boolean equals(Object o) {
25 if (this == o) return true;
26 if (o == null || getClass() != o.getClass()) return false;
27 Patnik patnik = (Patnik) o;
28 return Objects.equals(kId, patnik.kId);
29 }
30
31 @Override
32 public int hashCode() {
33 return Objects.hash(kId);
34 }
35
36 @OneToOne
37 @JoinColumn(name = "k_id", referencedColumnName = "k_id", nullable = false)
38 public Korisnik getKorisnikByKId() {
39 return korisnikByKId;
40 }
41
42 public void setKorisnikByKId(Korisnik korisnikByKId) {
43 this.korisnikByKId = korisnikByKId;
44 }
45}
Note: See TracBrowser for help on using the repository browser.