source: src/main/java/com/example/autopartz/model/Repair.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 Repair {
18 @Id
19 @GeneratedValue(strategy = GenerationType.IDENTITY)
20 @Column(name = "ID_repair")
21 Integer id;
22 @OneToOne
23 @JoinColumn(name = "id_order")
24 Order order;
25 @ManyToOne
26 @JoinColumn(name = "id_repair_shop")
27 RepairShop repairShop;
28 @ManyToOne
29 @JoinColumn(name = "id_service_book")
30 ServiceBook serviceBook;
31
32 public Repair(Order order, RepairShop repairShop, ServiceBook serviceBook) {
33 this.order = order;
34 this.repairShop = repairShop;
35 this.serviceBook = serviceBook;
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 Repair repair = (Repair) o;
42 return id != null && Objects.equals(id, repair.id);
43 }
44
45 @Override
46 public int hashCode() {
47 return getClass().hashCode();
48 }
49}
Note: See TracBrowser for help on using the repository browser.