1 | package com.wediscussmovies.project.model;
|
---|
2 |
|
---|
3 | import javax.persistence.*;
|
---|
4 | import java.util.Collection;
|
---|
5 |
|
---|
6 | @Entity
|
---|
7 | @Table(name = "genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
8 | public class Genre {
|
---|
9 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
10 | @Id
|
---|
11 | @Column(name = "genre_id")
|
---|
12 | private int genreId;
|
---|
13 | @Basic
|
---|
14 | @Column(name = "genre_type")
|
---|
15 | private String genreType;
|
---|
16 | @OneToMany(mappedBy = "genresByGenreId")
|
---|
17 | private Collection<MovieGenresEntity> movieGenresByGenreId;
|
---|
18 | @OneToMany(mappedBy = "genresByGenreId")
|
---|
19 | private Collection<UserGenresEntity> userGenresByGenreId;
|
---|
20 |
|
---|
21 | public int getGenreId() {
|
---|
22 | return genreId;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public void setGenreId(int genreId) {
|
---|
26 | this.genreId = genreId;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public String getGenreType() {
|
---|
30 | return genreType;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public void setGenreType(String genreType) {
|
---|
34 | this.genreType = genreType;
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public boolean equals(Object o) {
|
---|
39 | if (this == o) return true;
|
---|
40 | if (o == null || getClass() != o.getClass()) return false;
|
---|
41 |
|
---|
42 | Genre that = (Genre) o;
|
---|
43 |
|
---|
44 | if (genreId != that.genreId) return false;
|
---|
45 | if (genreType != null ? !genreType.equals(that.genreType) : that.genreType != null) return false;
|
---|
46 |
|
---|
47 | return true;
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public int hashCode() {
|
---|
52 | int result = genreId;
|
---|
53 | result = 31 * result + (genreType != null ? genreType.hashCode() : 0);
|
---|
54 | return result;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public Collection<MovieGenresEntity> getMovieGenresByGenreId() {
|
---|
58 | return movieGenresByGenreId;
|
---|
59 | }
|
---|
60 |
|
---|
61 | public void setMovieGenresByGenreId(Collection<MovieGenresEntity> movieGenresByGenreId) {
|
---|
62 | this.movieGenresByGenreId = movieGenresByGenreId;
|
---|
63 | }
|
---|
64 |
|
---|
65 | public Collection<UserGenresEntity> getUserGenresByGenreId() {
|
---|
66 | return userGenresByGenreId;
|
---|
67 | }
|
---|
68 |
|
---|
69 | public void setUserGenresByGenreId(Collection<UserGenresEntity> userGenresByGenreId) {
|
---|
70 | this.userGenresByGenreId = userGenresByGenreId;
|
---|
71 | }
|
---|
72 |
|
---|
73 | public Genre(String genreType) {
|
---|
74 | this.genreType = genreType;
|
---|
75 | }
|
---|
76 |
|
---|
77 | public Genre() {
|
---|
78 | }
|
---|
79 | }
|
---|