main
Last change
on this file since 5b447b0 was 5b447b0, checked in by Test <matonikolov77@…>, 2 years ago |
Adding models and resources
|
-
Property mode
set to
100644
|
File size:
891 bytes
|
Rev | Line | |
---|
[5b447b0] | 1 | package com.wediscussmovies.project.model.relation;
|
---|
| 2 |
|
---|
| 3 | import com.wediscussmovies.project.model.Genre;
|
---|
| 4 | import com.wediscussmovies.project.model.Movie;
|
---|
| 5 | import com.wediscussmovies.project.model.primarykeys.MovieGenresPK;
|
---|
| 6 | import lombok.Data;
|
---|
| 7 |
|
---|
| 8 | import javax.persistence.*;
|
---|
| 9 |
|
---|
| 10 | @Entity
|
---|
| 11 | @Table(name = "movie_genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
| 12 | @Data
|
---|
| 13 | public class MovieGenres {
|
---|
| 14 |
|
---|
| 15 | @EmbeddedId
|
---|
| 16 | private MovieGenresPK id;
|
---|
| 17 |
|
---|
| 18 | @ManyToOne
|
---|
| 19 | @MapsId(value = "genre_id")
|
---|
| 20 | @JoinColumn(name = "genre_id")
|
---|
| 21 | private Genre genre;
|
---|
| 22 |
|
---|
| 23 | @ManyToOne
|
---|
| 24 | @MapsId("movie_id")
|
---|
| 25 | @JoinColumn(name = "movie_id")
|
---|
| 26 | private Movie movie;
|
---|
| 27 |
|
---|
| 28 | public MovieGenres() {
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public MovieGenres(Movie movie, Genre genre) {
|
---|
| 32 | this.id = new MovieGenresPK(movie.getMovieId(),genre.getGenreId());
|
---|
| 33 | this.genre = genre;
|
---|
| 34 | this.movie = movie;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.