source: src/main/java/com/example/model/User.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
RevLine 
[a51a591]1package com.example.model;
2
3import com.example.model.Enumerations.Role;
4import lombok.Getter;
5import lombok.Setter;
6import org.hibernate.Hibernate;
7
8import javax.persistence.*;
9import java.time.LocalDate;
10import java.util.Objects;
11
12@Getter
13@Setter
14@Entity
15@Table(name = "korisnici")
16@Inheritance(strategy = InheritanceType.JOINED)
17public class User {
18 @Id
19 @GeneratedValue(strategy = GenerationType.IDENTITY)
20 @Column(name = "korisnik_id")
21 Integer id;
22 @Column(name = "datum_kreiran")
23 LocalDate date;
24 @Column(name = "ime")
25 String name;
26
27 String username;
28 @Column(name = "lozinka")
29 String password;
30 @Column(name = "tel_broj")
31 String number;
32
33 @Enumerated(value = EnumType.STRING)
34 Role role;
35
36 public User(String name, String username, String number, String password, Role role) {
37 this.date = LocalDate.now();
38 this.name = name;
39 this.username = username;
40 this.password = password;
41 this.number = number;
42 this.role = role;
43 }
44
45 public User(){
46
47 }
48
49// // @Override
50// public Collection<? extends GrantedAuthority> getAuthorities() {
51// return Collections.singletonList(Role.ROLE_USER);
52// }
53
54 @Override
55 public boolean equals(Object o) {
56 if (this == o) return true;
57 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
58 User that = (User) o;
59 return id != null && Objects.equals(id, that.id);
60 }
61}
Note: See TracBrowser for help on using the repository browser.