main
Last change
on this file since f484b14 was f484b14, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago |
Added full functionality for creating order
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[2e46f06] | 1 | package com.example.autopartz.model;
|
---|
| 2 |
|
---|
[ae042f4] | 3 | import lombok.Getter;
|
---|
| 4 | import lombok.RequiredArgsConstructor;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 | import lombok.ToString;
|
---|
[2e46f06] | 7 | import org.hibernate.Hibernate;
|
---|
| 8 |
|
---|
[ae042f4] | 9 | import javax.persistence.*;
|
---|
[2e46f06] | 10 | import java.util.Objects;
|
---|
| 11 |
|
---|
| 12 | @Getter
|
---|
| 13 | @Setter
|
---|
| 14 | @ToString
|
---|
| 15 | @RequiredArgsConstructor
|
---|
| 16 | @Entity
|
---|
| 17 | @Table(name = "car_sample")
|
---|
| 18 | public 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 |
|
---|
[f484b14] | 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 |
|
---|
[2e46f06] | 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.