-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathIngredient.java
41 lines (32 loc) · 940 Bytes
/
Ingredient.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
package guru.springframework.domain;
import javax.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(exclude = {"recipe"})
@Entity
public class Ingredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String description;
private BigDecimal amount;
@OneToOne(fetch = FetchType.EAGER)
private UnitOfMeasure uom;
@ManyToOne
private Recipe recipe;
public Ingredient() {
}
public Ingredient(String description, BigDecimal amount, UnitOfMeasure uom) {
this.description = description;
this.amount = amount;
this.uom = uom;
}
public Ingredient(String description, BigDecimal amount, UnitOfMeasure uom, Recipe recipe) {
this.description = description;
this.amount = amount;
this.uom = uom;
this.recipe = recipe;
}
}