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

main
Last change on this file since 2e46f06 was 2e46f06, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 19 months ago

Adding the models and testing one view

  • Property mode set to 100644
File size: 925 bytes
Line 
1package com.example.autopartz.model;
2
3import jakarta.persistence.*;
4import lombok.*;
5import org.hibernate.Hibernate;
6
7import java.util.Objects;
8
9@Getter
10@Setter
11@ToString
12@RequiredArgsConstructor
13@Entity
14@Table(name = "car_sample")
15public class CarSample {
16 @Id
17 Integer vin;
18 Integer year_of_production;
19 Integer engine_power;
20 Integer displacement;
21 String fuel_type;
22 Integer km_driven;
23 @ManyToOne
24 @JoinColumn(name = "id_user")
25 Client client;
26 @ManyToOne
27 @JoinColumn(name = "id_car")
28 Car car;
29
30 @Override
31 public boolean equals(Object o) {
32 if (this == o) return true;
33 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
34 CarSample carSample = (CarSample) o;
35 return vin != null && Objects.equals(vin, carSample.vin);
36 }
37
38 @Override
39 public int hashCode() {
40 return getClass().hashCode();
41 }
42}
Note: See TracBrowser for help on using the repository browser.