Changeset 2d57cad in Git for src/main/java/com/wediscussmovies/project/model/Genre.java
- Timestamp:
- 01/16/22 17:12:01 (3 years ago)
- Branches:
- main
- Children:
- 7fafead
- Parents:
- 839f96a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/model/Genre.java
r839f96a r2d57cad 1 1 package com.wediscussmovies.project.model; 2 2 3 import javax.persistence.Column; 4 import javax.persistence.Entity; 5 import javax.persistence.GeneratedValue; 6 import javax.persistence.Id; 3 import javax.persistence.*; 4 import java.util.Collection; 7 5 8 @Entity(name="genres") 6 @Entity 7 @Table(name = "genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 9 8 public class Genre { 9 @GeneratedValue(strategy = GenerationType.IDENTITY) 10 10 @Id 11 @GeneratedValue 12 @Column(name="genre_id", nullable = false, unique = true) 13 private int genre_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; 14 20 15 @Column(name="genre_type", length = 100, nullable = false, unique = true) 16 private String genre_type; 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 } 17 79 } 18 19 /*20 21 create table genres(22 genre_id serial primary key,23 genre_type varchar(100) not null unique24 );25 26 */
Note:
See TracChangeset
for help on using the changeset viewer.