Ignore:
Timestamp:
01/16/22 20:22:55 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
3ded84d
Parents:
2d57cad (diff), 7bc8942 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Resolving models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/model/User.java

    r2d57cad r7fafead  
    33import javax.persistence.*;
    44import java.util.Collection;
     5import java.util.List;
    56
    67@Entity
     
    1011    @Id
    1112    @Column(name = "user_id")
    12     private int userId;
    13     @Basic
    14     @Column(name = "username")
     13    private Long userId;
     14
    1515    private String username;
    16     @Basic
    17     @Column(name = "name")
     16
    1817    private String name;
    19     @Basic
    20     @Column(name = "surname")
     18
    2119    private String surname;
    22     @Basic
    23     @Column(name = "email")
     20
    2421    private String email;
    25     @Basic
    26     @Column(name = "password")
     22
    2723    private String password;
    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;
    4024
    41     public int getUserId() {
    42         return userId;
    43     }
     25    @ManyToMany
     26    private List<Movie> movies;
    4427
    45     public void setUserId(int userId) {
    46         this.userId = userId;
    47     }
    4828
    49     public String getUsername() {
    50         return username;
    51     }
    5229
    53     public void setUsername(String username) {
     30
     31    public User(String username, String name, String surname, String email, String password) {
    5432        this.username = username;
    55     }
    56 
    57     public String getName() {
    58         return name;
    59     }
    60 
    61     public void setName(String name) {
    6233        this.name = name;
    63     }
    64 
    65     public String getSurname() {
    66         return surname;
    67     }
    68 
    69     public void setSurname(String surname) {
    7034        this.surname = surname;
    71     }
    72 
    73     public String getEmail() {
    74         return email;
    75     }
    76 
    77     public void setEmail(String email) {
    7835        this.email = email;
    79     }
    80 
    81     public String getPassword() {
    82         return password;
    83     }
    84 
    85     public void setPassword(String password) {
    8636        this.password = password;
    8737    }
    8838
    89     @Override
    90     public boolean equals(Object o) {
    91         if (this == o) return true;
    92         if (o == null || getClass() != o.getClass()) return false;
    93 
    94         User that = (User) o;
    95 
    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;
     39    public User() {
    16340    }
    16441}
Note: See TracChangeset for help on using the changeset viewer.