main
Last change
on this file since 84652fb was 84652fb, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago |
Admin views for adding things to the database
|
-
Property mode
set to
100644
|
File size:
949 bytes
|
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 |
|
---|
[84652fb] | 9 | import javax.persistence.*;
|
---|
[2e46f06] | 10 | import java.util.Objects;
|
---|
| 11 |
|
---|
| 12 | @Getter
|
---|
| 13 | @Setter
|
---|
| 14 | @ToString
|
---|
| 15 | @RequiredArgsConstructor
|
---|
| 16 | @Entity
|
---|
| 17 | public class Warehouse {
|
---|
| 18 | @Id
|
---|
[4d67d70] | 19 | @Column(name = "id_warehouse")
|
---|
[84652fb] | 20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[4d67d70] | 21 | Integer id;
|
---|
[7d43957] | 22 | @Column(name = "warehouse_location")
|
---|
| 23 | String location;
|
---|
[2e46f06] | 24 |
|
---|
[84652fb] | 25 | public Warehouse(String name) {
|
---|
| 26 | this.location = name;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
[2e46f06] | 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;
|
---|
[4d67d70] | 34 | return id != null && Objects.equals(id, warehouse.id);
|
---|
[2e46f06] | 35 | }
|
---|
| 36 |
|
---|
| 37 | @Override
|
---|
| 38 | public int hashCode() {
|
---|
| 39 | return getClass().hashCode();
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.