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:
949 bytes
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import lombok.Getter;
|
---|
4 | import lombok.RequiredArgsConstructor;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.hibernate.Hibernate;
|
---|
8 |
|
---|
9 | import javax.persistence.*;
|
---|
10 | import java.util.Objects;
|
---|
11 |
|
---|
12 | @Getter
|
---|
13 | @Setter
|
---|
14 | @ToString
|
---|
15 | @RequiredArgsConstructor
|
---|
16 | @Entity
|
---|
17 | public class Warehouse {
|
---|
18 | @Id
|
---|
19 | @Column(name = "id_warehouse")
|
---|
20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
21 | Integer id;
|
---|
22 | @Column(name = "warehouse_location")
|
---|
23 | String location;
|
---|
24 |
|
---|
25 | public Warehouse(String name) {
|
---|
26 | this.location = name;
|
---|
27 | }
|
---|
28 |
|
---|
29 | @Override
|
---|
30 | public boolean equals(Object o) {
|
---|
31 | if (this == o) return true;
|
---|
32 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
33 | Warehouse warehouse = (Warehouse) o;
|
---|
34 | return id != null && Objects.equals(id, warehouse.id);
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public int hashCode() {
|
---|
39 | return getClass().hashCode();
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.