1 | package com.example.model;
|
---|
2 |
|
---|
3 | import com.example.model.Enumerations.Role;
|
---|
4 | import lombok.Data;
|
---|
5 | import org.hibernate.Hibernate;
|
---|
6 |
|
---|
7 | import javax.persistence.Column;
|
---|
8 | import javax.persistence.Entity;
|
---|
9 | import javax.persistence.ManyToMany;
|
---|
10 | import javax.persistence.Table;
|
---|
11 | import java.util.List;
|
---|
12 | import java.util.Objects;
|
---|
13 |
|
---|
14 | @Data
|
---|
15 | @Entity
|
---|
16 | @Table (name = "fotografi")
|
---|
17 | public class Photographer extends User{
|
---|
18 |
|
---|
19 | @Column(name = "cena")
|
---|
20 | Integer price;
|
---|
21 |
|
---|
22 | String portfolio;
|
---|
23 |
|
---|
24 | @ManyToMany(mappedBy = "photographerList")
|
---|
25 | List<Event> eventList;
|
---|
26 |
|
---|
27 | public Photographer(String name, String username, String number, String password,
|
---|
28 | Integer price, String portfolio, Role role) {
|
---|
29 | super(name, username, number, password, role);
|
---|
30 | this.price = price;
|
---|
31 | this.portfolio = portfolio;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public Photographer() {
|
---|
35 | }
|
---|
36 |
|
---|
37 | // @Override
|
---|
38 | // public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
39 | // return Collections.singletonList(Role.ROLE_PHOTOGRAPHER);
|
---|
40 | // }
|
---|
41 |
|
---|
42 | @Override
|
---|
43 | public boolean equals(Object o) {
|
---|
44 | if (this == o) return true;
|
---|
45 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
46 | Photographer that = (Photographer) o;
|
---|
47 | return id != null && Objects.equals(id, that.id);
|
---|
48 | }
|
---|
49 | }
|
---|