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:
824 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")
|
---|
| 15 | public class Car {
|
---|
| 16 | @Id
|
---|
| 17 | Long ID_car;
|
---|
| 18 | Integer in_production_since;
|
---|
| 19 | Integer in_production_till;
|
---|
| 20 | String car_type;
|
---|
| 21 | @ManyToOne
|
---|
| 22 | @JoinColumn(name = "id_car_manufacturer")
|
---|
| 23 | CarManufacturer car_manufacturer;
|
---|
| 24 |
|
---|
| 25 | @Override
|
---|
| 26 | public boolean equals(Object o) {
|
---|
| 27 | if (this == o) return true;
|
---|
| 28 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 29 | Car car = (Car) o;
|
---|
| 30 | return ID_car != null && Objects.equals(ID_car, car.ID_car);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @Override
|
---|
| 34 | public int hashCode() {
|
---|
| 35 | return getClass().hashCode();
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.