source: src/main/java/com/example/model/Waiter.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.3 KB
RevLine 
[a51a591]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 = "kelneri")
14public class Waiter extends User{
15
16 @Column(name = "slobodni_denovi")
17 Integer free_day;
18
19 @Column(name = "god_iskustvo")
20 Integer experience;
21
22 @ManyToOne
23 @JoinColumn(name = "korisnik_id_keterinzi")
24 Catering catering;
25
26 @ManyToMany(mappedBy = "waiterList")
27 List<Event> eventList;
28
29 public Waiter(String name, String username, String number, String password, Integer free_day,
30 Integer experience, Catering catering, Role role) {
31 super(name, username, number, password, role);
32 this.free_day = free_day;
33 this.experience = experience;
34 this.catering = catering;
35 }
36
37 public Waiter() {
38 }
39
40// @Override
41// public Collection<? extends GrantedAuthority> getAuthorities() {
42// return Collections.singletonList(Role.ROLE_WAITER);
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 Waiter that = (Waiter) o;
50 return id != null && Objects.equals(id, that.id);
51 }
52}
Note: See TracBrowser for help on using the repository browser.