source: Git/src/main/java/com/wediscussmovies/project/model/MovieRates.java@ 7fafead

main
Last change on this file since 7fafead was 7fafead, checked in by Test <matonikolov77@…>, 2 years ago

Resolving models

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package com.wediscussmovies.project.model;
2
3import javax.persistence.*;
4
5@Entity
6@Table(name = "movie_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
7@IdClass(MovieRatesPK.class)
8public class MovieRates {
9
10 @Id
11 @Column(name = "movie_id")
12 private Long movieId;
13
14 @Id
15 @Column(name = "user_id")
16 private Long userId;
17
18 private String reason;
19
20 @Column(name = "stars_rated")
21 private int stars;
22
23 @ManyToOne
24 @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false, insertable = false, updatable = false)
25 private Movie movie;
26
27 @ManyToOne
28 @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false, insertable = false, updatable = false)
29 private User user;
30
31 public MovieRates(Long movieId, Long userId, String reason, int starsRated) {
32 this.movieId = movieId;
33 this.userId = userId;
34 this.reason = reason;
35 this.stars = starsRated;
36 }
37
38 public MovieRates() {
39 }
40}
Note: See TracBrowser for help on using the repository browser.