main
Last change
on this file since 1dd9226 was 1dd9226, checked in by HristijanMitic00 <hristijan.mitic.01@…>, 17 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[1dd9226] | 1 | package model;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 |
|
---|
| 5 | import java.sql.Date;
|
---|
| 6 | import java.util.Objects;
|
---|
| 7 |
|
---|
| 8 | @Entity
|
---|
| 9 | @IdClass(CenaPK.class)
|
---|
| 10 | public class Cena {
|
---|
| 11 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 12 | @Id
|
---|
| 13 | @Column(name = "id_produkt")
|
---|
| 14 | private int idProdukt;
|
---|
| 15 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 16 | @Id
|
---|
| 17 | @Column(name = "cena_od")
|
---|
| 18 | private Date cenaOd;
|
---|
| 19 | @Basic
|
---|
| 20 | @Column(name = "cena_do")
|
---|
| 21 | private Date cenaDo;
|
---|
| 22 | @Basic
|
---|
| 23 | @Column(name = "iznos")
|
---|
| 24 | private int iznos;
|
---|
| 25 |
|
---|
| 26 | public int getIdProdukt() {
|
---|
| 27 | return idProdukt;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public void setIdProdukt(int idProdukt) {
|
---|
| 31 | this.idProdukt = idProdukt;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | public Date getCenaOd() {
|
---|
| 35 | return cenaOd;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public void setCenaOd(Date cenaOd) {
|
---|
| 39 | this.cenaOd = cenaOd;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | public Date getCenaDo() {
|
---|
| 43 | return cenaDo;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | public void setCenaDo(Date cenaDo) {
|
---|
| 47 | this.cenaDo = cenaDo;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public int getIznos() {
|
---|
| 51 | return iznos;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public void setIznos(int iznos) {
|
---|
| 55 | this.iznos = iznos;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | @Override
|
---|
| 59 | public boolean equals(Object o) {
|
---|
| 60 | if (this == o) return true;
|
---|
| 61 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 62 | Cena cena = (Cena) o;
|
---|
| 63 | return idProdukt == cena.idProdukt && iznos == cena.iznos && Objects.equals(cenaOd, cena.cenaOd) && Objects.equals(cenaDo, cena.cenaDo);
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | @Override
|
---|
| 67 | public int hashCode() {
|
---|
| 68 | return Objects.hash(idProdukt, cenaOd, cenaDo, iznos);
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.