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

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

Admin views for adding things to the database

  • 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.util.Objects;
11
12@Getter
13@Setter
14@ToString
15@RequiredArgsConstructor
16@Entity
17@Table(name = "car_manufacturer", schema = "project")
18public class CarManufacturer {
19 @Id
20 @GeneratedValue(strategy = GenerationType.IDENTITY)
21 @Column(name = "id_car_manufacturer")
22 Integer id;
23 @Column(name = "cm_name")
24 String cmname;
25 String cm_country;
26
27 public CarManufacturer(String cmname, String cm_country) {
28 this.cmname = cmname;
29 this.cm_country = cm_country;
30 }
31
32 @Override
33 public boolean equals(Object o) {
34 if (this == o) return true;
35 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
36 CarManufacturer that = (CarManufacturer) o;
37 return id != null && Objects.equals(id, that.id);
38 }
39
40 @Override
41 public int hashCode() {
42 return getClass().hashCode();
43 }
44}
Note: See TracBrowser for help on using the repository browser.