source: src/main/java/com/example/autopartz/model/ServiceBook.java

main
Last change on this file was f484b14, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago

Added full functionality for creating order

  • Property mode set to 100644
File size: 1.1 KB
Line 
1package com.example.autopartz.model;
2
3import lombok.Getter;
4import lombok.RequiredArgsConstructor;
5import lombok.Setter;
6import lombok.ToString;
7import org.hibernate.Hibernate;
8
9import javax.persistence.*;
10import java.time.LocalDateTime;
11import java.util.Objects;
12
13@Getter
14@Setter
15@ToString
16@RequiredArgsConstructor
17@Entity
18@Table(name = "service_book")
19public class ServiceBook {
20 @Id
21 @Column(name = "ID_service_book")
22 @GeneratedValue(strategy = GenerationType.IDENTITY)
23 Integer id;
24 LocalDateTime sb_created_on;
25 @OneToOne
26 @JoinColumn(name = "vin")
27 CarSample carSample;
28
29 public ServiceBook(CarSample carSample) {
30 this.sb_created_on = LocalDateTime.now();
31 this.carSample = carSample;
32 }
33
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;
39 return id != null && Objects.equals(id, that.id);
40 }
41
42 @Override
43 public int hashCode() {
44 return getClass().hashCode();
45 }
46}
Note: See TracBrowser for help on using the repository browser.