-
Notifications
You must be signed in to change notification settings - Fork 8
/
Coffee.java
79 lines (63 loc) · 1.67 KB
/
Coffee.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package cafe.model.entity;
import java.io.Serializable;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.NamedQuery;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@Entity
@NamedQuery(name = "findAllCoffees", query = "SELECT o FROM Coffee o")
public class Coffee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
protected String name;
protected Double price;
public Coffee() {
}
public Coffee(String name, Double price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Coffee)) {
return false;
}
Coffee other = (Coffee) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "cafe.model.entity.Coffee[id=" + id + ", name=" + name + ", price=" + price + "]";
}
}