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.1 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.time.LocalDateTime;
|
---|
| 11 | import java.util.Objects;
|
---|
| 12 |
|
---|
| 13 | @Getter
|
---|
| 14 | @Setter
|
---|
| 15 | @ToString
|
---|
| 16 | @RequiredArgsConstructor
|
---|
| 17 | @Entity
|
---|
| 18 | @Table(name = "service_book")
|
---|
| 19 | public class ServiceBook {
|
---|
| 20 | @Id
|
---|
[f484b14] | 21 | @Column(name = "ID_service_book")
|
---|
| 22 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 23 | Integer id;
|
---|
[2e46f06] | 24 | LocalDateTime sb_created_on;
|
---|
| 25 | @OneToOne
|
---|
| 26 | @JoinColumn(name = "vin")
|
---|
| 27 | CarSample carSample;
|
---|
| 28 |
|
---|
[f484b14] | 29 | public ServiceBook(CarSample carSample) {
|
---|
| 30 | this.sb_created_on = LocalDateTime.now();
|
---|
| 31 | this.carSample = carSample;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
[2e46f06] | 34 | @Override
|
---|
| 35 | public boolean equals(Object o) {
|
---|
| 36 | if (this == o) return true;
|
---|
| 37 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 38 | ServiceBook that = (ServiceBook) o;
|
---|
[f484b14] | 39 | return id != null && Objects.equals(id, that.id);
|
---|
[2e46f06] | 40 | }
|
---|
| 41 |
|
---|
| 42 | @Override
|
---|
| 43 | public int hashCode() {
|
---|
| 44 | return getClass().hashCode();
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.