main
Last change
on this file since 60de3eb was feffc2f, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago |
Added some views and functionalities
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.*;
|
---|
5 | import org.hibernate.Hibernate;
|
---|
6 |
|
---|
7 | import java.time.LocalDateTime;
|
---|
8 | import java.util.Objects;
|
---|
9 |
|
---|
10 | @Getter
|
---|
11 | @Setter
|
---|
12 | @ToString
|
---|
13 | @RequiredArgsConstructor
|
---|
14 | @Entity
|
---|
15 | @Table(name = "users_table")
|
---|
16 | @Inheritance(strategy = InheritanceType.JOINED)
|
---|
17 | public class User {
|
---|
18 | @Id
|
---|
19 | Long ID_user;
|
---|
20 | String username;
|
---|
21 | String email;
|
---|
22 | String name_user;
|
---|
23 | @Column(name = "password_user")
|
---|
24 | String password;
|
---|
25 | LocalDateTime user_created_on;
|
---|
26 | String phone_number;
|
---|
27 | @ManyToOne
|
---|
28 | @JoinColumn(name = "id_administrator")
|
---|
29 | Administrator administrator;
|
---|
30 |
|
---|
31 | public User(String username, String name, String email, String password, String number) {
|
---|
32 | this.username = username;
|
---|
33 | this.name_user = name;
|
---|
34 | this.email = email;
|
---|
35 | this.password = password;
|
---|
36 | this.phone_number = number;
|
---|
37 | this.user_created_on = LocalDateTime.now();
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public boolean equals(Object o) {
|
---|
42 | if (this == o) return true;
|
---|
43 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
44 | User user = (User) o;
|
---|
45 | return ID_user != null && Objects.equals(ID_user, user.ID_user);
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | public int hashCode() {
|
---|
50 | return getClass().hashCode();
|
---|
51 | }
|
---|
52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.