source: src/main/java/com/example/model/Catering.java

Last change on this file was a51a591, checked in by colovik <j.colovik@…>, 14 months ago

final

  • Property mode set to 100644
File size: 1.5 KB
Line 
1package com.example.model;
2
3import com.example.model.Enumerations.Role;
4import lombok.Data;
5import org.hibernate.Hibernate;
6
7import javax.persistence.*;
8import java.util.List;
9import java.util.Objects;
10
11@Data
12@Entity
13@Table(name = "keterinzi")
14public class Catering extends User {
15
16 @Column(name = "cena")
17 Integer price;
18
19 @Column(name = "adresa")
20 String address;
21
22 @OneToMany(mappedBy = "catering_id")
23 List<Client> clients;
24
25 @OneToMany(mappedBy = "catering")
26 List<Waiter> waiters;
27
28 @ManyToMany
29 @JoinTable(name = "ketering_nudi_produkt",
30 joinColumns = @JoinColumn(name = "korisnik_id"),
31 inverseJoinColumns = @JoinColumn(name = "produkt_id"))
32// @ToString.Exclude
33 List<Product> productList;
34
35 @ManyToMany(mappedBy = "cateringList")
36 List<Event> eventList;
37
38 public Catering(String name, String username, String number, String password,
39 Integer price, String address, Role role) {
40 super(name, username, number, password, role);
41 this.price = price;
42 this.address = address;
43 }
44
45 public Catering() {
46 }
47
48// @Override
49// public Collection<? extends GrantedAuthority> getAuthorities() {
50// return Collections.singletonList(Role.ROLE_CATERING);
51// }
52
53 @Override
54 public boolean equals(Object o) {
55 if (this == o) return true;
56 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
57 Catering that = (Catering) o;
58 return id != null && Objects.equals(id, that.id);
59 }
60}
Note: See TracBrowser for help on using the repository browser.