[6e7b472] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
| 3 | import javax.persistence.*;
|
---|
[2d57cad] | 4 | import java.util.Collection;
|
---|
[6e7b472] | 5 |
|
---|
[2d57cad] | 6 | @Entity
|
---|
| 7 | @Table(name = "users", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
[6e7b472] | 8 | public class User {
|
---|
[2d57cad] | 9 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[6e7b472] | 10 | @Id
|
---|
[2d57cad] | 11 | @Column(name = "user_id")
|
---|
| 12 | private int userId;
|
---|
| 13 | @Basic
|
---|
| 14 | @Column(name = "username")
|
---|
[6e7b472] | 15 | private String username;
|
---|
[2d57cad] | 16 | @Basic
|
---|
| 17 | @Column(name = "name")
|
---|
[6e7b472] | 18 | private String name;
|
---|
[2d57cad] | 19 | @Basic
|
---|
| 20 | @Column(name = "surname")
|
---|
[6e7b472] | 21 | private String surname;
|
---|
[2d57cad] | 22 | @Basic
|
---|
| 23 | @Column(name = "email")
|
---|
[6e7b472] | 24 | private String email;
|
---|
[2d57cad] | 25 | @Basic
|
---|
| 26 | @Column(name = "password")
|
---|
[6e7b472] | 27 | private String password;
|
---|
[2d57cad] | 28 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 29 | private Collection<Discussion> discussionsByUserId;
|
---|
| 30 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 31 | private Collection<MovieLikesEntity> movieLikesByUserId;
|
---|
| 32 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 33 | private Collection<MovieRatesEntity> movieRatesByUserId;
|
---|
| 34 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 35 | private Collection<PersonRatesEntity> personRatesByUserId;
|
---|
| 36 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 37 | private Collection<Reply> repliesByUserId;
|
---|
| 38 | @OneToMany(mappedBy = "usersByUserId")
|
---|
| 39 | private Collection<UserGenresEntity> userGenresByUserId;
|
---|
[6e7b472] | 40 |
|
---|
[2d57cad] | 41 | public int getUserId() {
|
---|
| 42 | return userId;
|
---|
| 43 | }
|
---|
[6e7b472] | 44 |
|
---|
[2d57cad] | 45 | public void setUserId(int userId) {
|
---|
| 46 | this.userId = userId;
|
---|
| 47 | }
|
---|
[6e7b472] | 48 |
|
---|
[2d57cad] | 49 | public String getUsername() {
|
---|
| 50 | return username;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public void setUsername(String username) {
|
---|
| 54 | this.username = username;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | public String getName() {
|
---|
| 58 | return name;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public void setName(String name) {
|
---|
| 62 | this.name = name;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public String getSurname() {
|
---|
| 66 | return surname;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | public void setSurname(String surname) {
|
---|
| 70 | this.surname = surname;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public String getEmail() {
|
---|
| 74 | return email;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | public void setEmail(String email) {
|
---|
| 78 | this.email = email;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | public String getPassword() {
|
---|
| 82 | return password;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | public void setPassword(String password) {
|
---|
| 86 | this.password = password;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | @Override
|
---|
| 90 | public boolean equals(Object o) {
|
---|
| 91 | if (this == o) return true;
|
---|
| 92 | if (o == null || getClass() != o.getClass()) return false;
|
---|
[6e7b472] | 93 |
|
---|
[2d57cad] | 94 | User that = (User) o;
|
---|
[6e7b472] | 95 |
|
---|
[2d57cad] | 96 | if (userId != that.userId) return false;
|
---|
| 97 | if (username != null ? !username.equals(that.username) : that.username != null) return false;
|
---|
| 98 | if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
---|
| 99 | if (surname != null ? !surname.equals(that.surname) : that.surname != null) return false;
|
---|
| 100 | if (email != null ? !email.equals(that.email) : that.email != null) return false;
|
---|
| 101 | if (password != null ? !password.equals(that.password) : that.password != null) return false;
|
---|
| 102 |
|
---|
| 103 | return true;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | @Override
|
---|
| 107 | public int hashCode() {
|
---|
| 108 | int result = userId;
|
---|
| 109 | result = 31 * result + (username != null ? username.hashCode() : 0);
|
---|
| 110 | result = 31 * result + (name != null ? name.hashCode() : 0);
|
---|
| 111 | result = 31 * result + (surname != null ? surname.hashCode() : 0);
|
---|
| 112 | result = 31 * result + (email != null ? email.hashCode() : 0);
|
---|
| 113 | result = 31 * result + (password != null ? password.hashCode() : 0);
|
---|
| 114 | return result;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | public Collection<Discussion> getDiscussionsByUserId() {
|
---|
| 118 | return discussionsByUserId;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | public void setDiscussionsByUserId(Collection<Discussion> discussionsByUserId) {
|
---|
| 122 | this.discussionsByUserId = discussionsByUserId;
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | public Collection<MovieLikesEntity> getMovieLikesByUserId() {
|
---|
| 126 | return movieLikesByUserId;
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | public void setMovieLikesByUserId(Collection<MovieLikesEntity> movieLikesByUserId) {
|
---|
| 130 | this.movieLikesByUserId = movieLikesByUserId;
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | public Collection<MovieRatesEntity> getMovieRatesByUserId() {
|
---|
| 134 | return movieRatesByUserId;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | public void setMovieRatesByUserId(Collection<MovieRatesEntity> movieRatesByUserId) {
|
---|
| 138 | this.movieRatesByUserId = movieRatesByUserId;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | public Collection<PersonRatesEntity> getPersonRatesByUserId() {
|
---|
| 142 | return personRatesByUserId;
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | public void setPersonRatesByUserId(Collection<PersonRatesEntity> personRatesByUserId) {
|
---|
| 146 | this.personRatesByUserId = personRatesByUserId;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | public Collection<Reply> getRepliesByUserId() {
|
---|
| 150 | return repliesByUserId;
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | public void setRepliesByUserId(Collection<Reply> repliesByUserId) {
|
---|
| 154 | this.repliesByUserId = repliesByUserId;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | public Collection<UserGenresEntity> getUserGenresByUserId() {
|
---|
| 158 | return userGenresByUserId;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | public void setUserGenresByUserId(Collection<UserGenresEntity> userGenresByUserId) {
|
---|
| 162 | this.userGenresByUserId = userGenresByUserId;
|
---|
| 163 | }
|
---|
| 164 | }
|
---|