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

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

Admin views for adding things to the database

  • Property mode set to 100644
File size: 1.5 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.List;
11import java.util.Objects;
12
13@Getter
14@Setter
15@ToString
16@RequiredArgsConstructor
17@Entity
18@Table(name = "repair_shop")
19public class RepairShop {
20 @Id
21 @Column(name = "ID_repair_shop")
22 @GeneratedValue(strategy = GenerationType.IDENTITY)
23 Integer id;
24 @Column(name = "rs_name")
25 String name;
26 @Column(name = "rs_location")
27 String location;
28 @Column(name = "rs_phone_number")
29 String number;
30 @ManyToMany
31 @JoinTable(name = "repair_shop_is_authorized_for_car_make", joinColumns =
32 @JoinColumn(name = "id_repair_shop"),
33 inverseJoinColumns = @JoinColumn(name = "id_car_manufacturer"))
34 @ToString.Exclude
35 List<CarManufacturer> carManufacturerList;
36
37 public RepairShop(String name, String location, String number, List<CarManufacturer> carManufacturerList) {
38 this.name = name;
39 this.location = location;
40 this.number = number;
41 this.carManufacturerList = carManufacturerList;
42 }
43
44 @Override
45 public boolean equals(Object o) {
46 if (this == o) return true;
47 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
48 RepairShop that = (RepairShop) o;
49 return id != null && Objects.equals(id, that.id);
50 }
51
52 @Override
53 public int hashCode() {
54 return getClass().hashCode();
55 }
56}
Note: See TracBrowser for help on using the repository browser.