source: src/main/java/com/example/autopartz/model/Review.java

main
Last change on this file was d4b888e, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago

Added full functionality for adding review

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.example.autopartz.model;
2
3import lombok.Getter;
4import lombok.RequiredArgsConstructor;
5import lombok.Setter;
6import lombok.ToString;
7import org.hibernate.Hibernate;
8
9import javax.persistence.*;
10import java.util.Objects;
11
12@Getter
13@Setter
14@ToString
15@RequiredArgsConstructor
16@Entity
17public class Review {
18 @Id
19 @GeneratedValue(strategy = GenerationType.IDENTITY)
20 Integer ID_review;
21 Integer review_rating;
22 String review_comment;
23 @ManyToOne
24 @JoinColumn(name = "id_repair")
25 Repair repair;
26 @ManyToOne
27 @JoinColumn(name = "id_user")
28 Client client;
29
30 public Review(Integer review_rating, String review_comment, Repair repair, Client client) {
31 this.review_rating = review_rating;
32 this.review_comment = review_comment;
33 this.repair = repair;
34 this.client = client;
35 }
36
37 @Override
38 public boolean equals(Object o) {
39 if (this == o) return true;
40 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
41 Review review = (Review) o;
42 return ID_review != null && Objects.equals(ID_review, review.ID_review);
43 }
44
45 @Override
46 public int hashCode() {
47 return getClass().hashCode();
48 }
49}
Note: See TracBrowser for help on using the repository browser.