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
|
Rev | Line | |
---|
[2e46f06] | 1 | package com.example.autopartz.model;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 | import lombok.*;
|
---|
| 5 | import org.hibernate.Hibernate;
|
---|
| 6 |
|
---|
| 7 | import java.util.Objects;
|
---|
| 8 |
|
---|
| 9 | @Getter
|
---|
| 10 | @Setter
|
---|
| 11 | @ToString
|
---|
| 12 | @RequiredArgsConstructor
|
---|
| 13 | @Entity
|
---|
| 14 | @Table(name = "car_sample")
|
---|
| 15 | public 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.