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

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

Added full functionality for creating order

  • Property mode set to 100644
File size: 1.4 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
17@Table(name = "car_sample")
18public class CarSample {
19 @Id
20 Integer vin;
21 Integer year_of_production;
22 Integer engine_power;
23 Integer displacement;
24 String fuel_type;
25 Integer km_driven;
26 @ManyToOne
27 @JoinColumn(name = "id_user")
28 Client client;
29 @ManyToOne
30 @JoinColumn(name = "id_car")
31 Car car;
32
33
34 public CarSample(Integer vin,Integer year_of_production, Integer engine_power, Integer displacement, String fuel_type, Integer km_driven, Client client, Car car) {
35 this.vin = vin;
36 this.year_of_production = year_of_production;
37 this.engine_power = engine_power;
38 this.displacement = displacement;
39 this.fuel_type = fuel_type;
40 this.km_driven = km_driven;
41 this.client = client;
42 this.car = car;
43 }
44
45 @Override
46 public boolean equals(Object o) {
47 if (this == o) return true;
48 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
49 CarSample carSample = (CarSample) o;
50 return vin != null && Objects.equals(vin, carSample.vin);
51 }
52
53 @Override
54 public int hashCode() {
55 return getClass().hashCode();
56 }
57}
Note: See TracBrowser for help on using the repository browser.