[24c39f9] | 1 | package mk.ukim.finki.busngo.model;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 |
|
---|
| 5 | import java.util.Objects;
|
---|
| 6 |
|
---|
| 7 | @Entity
|
---|
| 8 | public class Kaznazaregistriran {
|
---|
| 9 | private Long kzId;
|
---|
| 10 | private Long patnikKId;
|
---|
| 11 | private Kazna kaznaByKzId;
|
---|
| 12 | private Korisnik korisnikByPatnikKId;
|
---|
| 13 |
|
---|
| 14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 15 | @Id
|
---|
| 16 | @Column(name = "kz_id", nullable = false)
|
---|
| 17 | public Long getKzId() {
|
---|
| 18 | return kzId;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public void setKzId(Long kzId) {
|
---|
| 22 | this.kzId = kzId;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | @Basic
|
---|
| 26 | @Column(name = "patnik_k_id", nullable = true)
|
---|
| 27 | public Long getPatnikKId() {
|
---|
| 28 | return patnikKId;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public void setPatnikKId(Long patnikKId) {
|
---|
| 32 | this.patnikKId = patnikKId;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | @Override
|
---|
| 36 | public boolean equals(Object o) {
|
---|
| 37 | if (this == o) return true;
|
---|
| 38 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 39 | Kaznazaregistriran that = (Kaznazaregistriran) o;
|
---|
| 40 | return Objects.equals(kzId, that.kzId) && Objects.equals(patnikKId, that.patnikKId);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | @Override
|
---|
| 44 | public int hashCode() {
|
---|
| 45 | return Objects.hash(kzId, patnikKId);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | @OneToOne
|
---|
| 49 | @JoinColumn(name = "kz_id", referencedColumnName = "kz_id", nullable = false)
|
---|
| 50 | public Kazna getKaznaByKzId() {
|
---|
| 51 | return kaznaByKzId;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public void setKaznaByKzId(Kazna kaznaByKzId) {
|
---|
| 55 | this.kaznaByKzId = kaznaByKzId;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | @ManyToOne
|
---|
| 59 | @JoinColumn(name = "patnik_k_id", referencedColumnName = "k_id")
|
---|
| 60 | public Korisnik getKorisnikByPatnikKId() {
|
---|
| 61 | return korisnikByPatnikKId;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public void setKorisnikByPatnikKId(Korisnik korisnikByPatnikKId) {
|
---|
| 65 | this.korisnikByPatnikKId = korisnikByPatnikKId;
|
---|
| 66 | }
|
---|
| 67 | }
|
---|