source: Git/src/main/java/com/wediscussmovies/project/model/PersonRatesEntity.java@ 2d57cad

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

Initial model part

  • Property mode set to 100644
File size: 2.5 KB
Line 
1package com.wediscussmovies.project.model;
2
3import javax.persistence.*;
4
5@Entity
6@Table(name = "person_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
7@IdClass(PersonRatesEntityPK.class)
8public class PersonRatesEntity {
9 @Id
10 @Column(name = "person_id")
11 private int personId;
12 @Id
13 @Column(name = "user_id")
14 private int userId;
15 @Basic
16 @Column(name = "reason")
17 private String reason;
18 @Basic
19 @Column(name = "stars_rated")
20 private int starsRated;
21 @ManyToOne
22 @JoinColumn(name = "person_id", referencedColumnName = "person_id", nullable = false,insertable = false, updatable = false)
23 private Person personsByPersonId;
24 @ManyToOne
25 @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
26 private User usersByUserId;
27
28 public int getPersonId() {
29 return personId;
30 }
31
32 public void setPersonId(int personId) {
33 this.personId = personId;
34 }
35
36 public int getUserId() {
37 return userId;
38 }
39
40 public void setUserId(int userId) {
41 this.userId = userId;
42 }
43
44 public String getReason() {
45 return reason;
46 }
47
48 public void setReason(String reason) {
49 this.reason = reason;
50 }
51
52 public int getStarsRated() {
53 return starsRated;
54 }
55
56 public void setStarsRated(int starsRated) {
57 this.starsRated = starsRated;
58 }
59
60 @Override
61 public boolean equals(Object o) {
62 if (this == o) return true;
63 if (o == null || getClass() != o.getClass()) return false;
64
65 PersonRatesEntity that = (PersonRatesEntity) o;
66
67 if (personId != that.personId) return false;
68 if (userId != that.userId) return false;
69 if (starsRated != that.starsRated) return false;
70 if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
71
72 return true;
73 }
74
75 @Override
76 public int hashCode() {
77 int result = personId;
78 result = 31 * result + userId;
79 result = 31 * result + (reason != null ? reason.hashCode() : 0);
80 result = 31 * result + starsRated;
81 return result;
82 }
83
84 public Person getPersonsByPersonId() {
85 return personsByPersonId;
86 }
87
88 public void setPersonsByPersonId(Person personsByPersonId) {
89 this.personsByPersonId = personsByPersonId;
90 }
91
92 public User getUsersByUserId() {
93 return usersByUserId;
94 }
95
96 public void setUsersByUserId(User usersByUserId) {
97 this.usersByUserId = usersByUserId;
98 }
99}
Note: See TracBrowser for help on using the repository browser.