Changes in src/main/java/com/wediscussmovies/project/model/Genre.java [2a5d6a3:2d57cad] in Git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/model/Genre.java
r2a5d6a3 r2d57cad 1 1 package com.wediscussmovies.project.model; 2 2 3 import lombok.Data; 3 import javax.persistence.*; 4 import java.util.Collection; 4 5 5 import javax.persistence.*; 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; 6 20 7 @Data 8 @Entity 9 @Table(name="genres") 10 public class Genre { 11 @Id 12 @GeneratedValue 13 @Column(name="genre_id", nullable = false, unique = true) 14 private int genre_id; 21 public int getGenreId() { 22 return genreId; 23 } 15 24 16 @Column(name="genre_type", length = 100, nullable = false, unique = true) 17 private String genre_type; 25 public void setGenreId(int genreId) { 26 this.genreId = genreId; 27 } 18 28 19 public Genre(String genreName) { 20 this.genre_type = genreName; 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; 21 75 } 22 76 … … 24 78 } 25 79 } 26 27 /*28 29 create table genres(30 genre_id serial primary key,31 genre_type varchar(100) not null unique32 );33 34 */
Note:
See TracChangeset
for help on using the changeset viewer.